1 /* Target hook definitions for C
-family front ends.
2 Copyright (C
) 2001-2024 Free Software Foundation
, Inc.
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
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.
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
/>.
*/
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"
23 #define HOOK_TYPE
"C Target Hook"
25 HOOK_VECTOR (TARGETCM_INITIALIZER
, gcc_targetcm
)
28 #define HOOK_PREFIX
"TARGET_"
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.
*/
38 bool
, (size_t code
, const char
*arg
, int value
),
39 default_handle_c_option
)
41 /* Targets may provide a string object type that can be used within
42 and between C
, C
++, and Objective
-C dialects.
*/
45 (objc_construct_string_object
,
46 "Targets may provide a string object type that can be used within\n\
47 and between C, C++ and their respective Objective-C dialects.\n\
48 A string object might, for example, embed encoding and length information.\n\
49 These objects are considered opaque to the compiler and handled as references.\n\
50 An ideal implementation makes the composition of the string object\n\
51 match that of the Objective-C @code{NSString} (@code{NXString} for GNUStep),\n\
52 allowing efficient interworking between C-only and Objective-C code.\n\
53 If a target implements string objects then this hook should return a\n\
54 reference to such an object constructed from the normal `C' string\n\
55 representation provided in @var{string}.\n\
56 At present, the hook is used by Objective-C only, to obtain a\n\
57 common-format string object when the target provides one.",
62 (objc_declare_unresolved_class_reference
,
63 "Declare that Objective C class @var{classname} is referenced\n\
65 void
, (const char
*classname
),
69 (objc_declare_class_definition
,
70 "Declare that Objective C class @var{classname} is defined\n\
72 void
, (const char
*classname
),
76 (string_object_ref_type_p
,
77 "If a target implements string objects then this hook should return\n\
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
)
83 (check_string_object_format_arg
,
84 "If a target implements string objects then this hook should\n\
85 provide a facility to check the function arguments in @var{args_list}\n\
86 against the format specifiers in @var{format_arg} where the type of\n\
87 @var{format_arg} is one recognized as a valid string reference type.",
88 void
, (tree format_arg
, tree args_list
),
93 "Define this hook to return the name of a header file to be included at\n\
94 the start of all compilations, as if it had been included with\n\
95 @code{#include <@var{file}>}. If this hook returns @code{NULL}, or is\n\
96 not defined, or the header is not found, or if the user specifies\n\
97 @option{-ffreestanding} or @option{-nostdinc}, no header is included.\n\
99 This hook can be used together with a header provided by the system C\n\
100 library to implement ISO C requirements for certain macros to be\n\
101 predefined that describe properties of the whole implementation rather\n\
102 than just the compiler.",
103 const char
*, (void
),
104 hook_constcharptr_void_null
)
107 (cxx_implicit_extern_c
,
108 "Define this hook to add target-specific C++ implicit extern C functions.\n\
109 If this function returns true for the name of a file-scope function, that\n\
110 function implicitly gets extern \"C\" linkage rather than whatever language\n\
111 linkage the declaration would normally have. An example of such function\n\
112 is WinMain on Win32 targets.",
116 HOOK_VECTOR_END (C90_EMPTY_HACK
)