1/* Target hook definitions for C-family front ends.
2 Copyright (C) 2001-2017 Free Software Foundation, Inc.
3
4 This program is free software; you can redistribute it and/or modify it
5 under the terms of the GNU General Public License as published by the
6 Free Software Foundation; either version 3, or (at your option) any
7 later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; see the file COPYING3. If not see
16 <http://www.gnu.org/licenses/>. */
17
18/* See target-hooks-macros.h for details of macros that should be
19 provided by the including file, and how to use them here. */
20#include "target-hooks-macros.h"
21
22#undef HOOK_TYPE
23#define HOOK_TYPE "C Target Hook"
24
25HOOK_VECTOR (TARGETCM_INITIALIZER, gcc_targetcm)
26
27#undef HOOK_PREFIX
28#define HOOK_PREFIX "TARGET_"
29
30/* Handle target switch CODE (an OPT_* value). ARG is the argument
31 passed to the switch; it is NULL if no argument was. VALUE is the
32 value of ARG if CODE specifies a UInteger option, otherwise it is
33 1 if the positive form of the switch was used and 0 if the negative
34 form was. Return true if the switch was valid. */
35DEFHOOK
36(handle_c_option,
37 "",
38 bool, (size_t code, const char *arg, int value),
39 default_handle_c_option)
40
41/* Targets may provide a string object type that can be used within
42 and between C, C++, and Objective-C dialects. */
43
44DEFHOOK
45(objc_construct_string_object,
46 "Targets may provide a string object type that can be used within\
47 and between C, C++ and their respective Objective-C dialects.\
48 A string object might, for example, embed encoding and length information.\
49 These objects are considered opaque to the compiler and handled as references.\
50 An ideal implementation makes the composition of the string object\
51 match that of the Objective-C @code{NSString} (@code{NXString} for GNUStep),\
52 allowing efficient interworking between C-only and Objective-C code.\
53 If a target implements string objects then this hook should return a\
54 reference to such an object constructed from the normal `C' string\
55 representation provided in @var{string}.\
56 At present, the hook is used by Objective-C only, to obtain a\
57 common-format string object when the target provides one.",
58 tree, (tree string),
59 NULL)
60
61DEFHOOK
62(objc_declare_unresolved_class_reference,
63 "Declare that Objective C class @var{classname} is referenced\
64 by the current TU.",
65 void, (const char *classname),
66 NULL)
67
68DEFHOOK
69(objc_declare_class_definition,
70 "Declare that Objective C class @var{classname} is defined\
71 by the current TU.",
72 void, (const char *classname),
73 NULL)
74
75DEFHOOK
76(string_object_ref_type_p,
77 "If a target implements string objects then this hook should return\
78 @code{true} if @var{stringref} is a valid reference to such an object.",
79 bool, (const_tree stringref),
80 hook_bool_const_tree_false)
81
82DEFHOOK
83(check_string_object_format_arg,
84 "If a target implements string objects then this hook should should\
85 provide a facility to check the function arguments in @var{args_list}\
86 against the format specifiers in @var{format_arg} where the type of\
87 @var{format_arg} is one recognized as a valid string reference type.",
88 void, (tree format_arg, tree args_list),
89 NULL)
90
91DEFHOOK
92(c_preinclude,
93 "Define this hook to return the name of a header file to be included at\
94 the start of all compilations, as if it had been included with\
95 @code{#include <@var{file}>}. If this hook returns @code{NULL}, or is\
96 not defined, or the header is not found, or if the user specifies\
97 @option{-ffreestanding} or @option{-nostdinc}, no header is included.\n\
98\n\
99 This hook can be used together with a header provided by the system C\
100 library to implement ISO C requirements for certain macros to be\
101 predefined that describe properties of the whole implementation rather\
102 than just the compiler.",
103 const char *, (void),
104 hook_constcharptr_void_null)
105
106DEFHOOK
107(cxx_implicit_extern_c,
108 "Define this hook to add target-specific C++ implicit extern C functions.\
109 If this function returns true for the name of a file-scope function, that\
110 function implicitly gets extern \"C\" linkage rather than whatever language\
111 linkage the declaration would normally have. An example of such function\
112 is WinMain on Win32 targets.",
113 bool, (const char*),
114 NULL)
115
116HOOK_VECTOR_END (C90_EMPTY_HACK)
117