1/* Target hook definitions for C-family front ends.
2 Copyright (C) 2001-2023 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\n\
47and between C, C++ and their respective Objective-C dialects.\n\
48A string object might, for example, embed encoding and length information.\n\
49These objects are considered opaque to the compiler and handled as references.\n\
50An ideal implementation makes the composition of the string object\n\
51match that of the Objective-C @code{NSString} (@code{NXString} for GNUStep),\n\
52allowing efficient interworking between C-only and Objective-C code.\n\
53If a target implements string objects then this hook should return a\n\
54reference to such an object constructed from the normal `C' string\n\
55representation provided in @var{string}.\n\
56At present, the hook is used by Objective-C only, to obtain a\n\
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\n\
64by 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\n\
71by 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\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)
81
82DEFHOOK
83(check_string_object_format_arg,
84 "If a target implements string objects then this hook should\n\
85provide a facility to check the function arguments in @var{args_list}\n\
86against 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),
89 NULL)
90
91DEFHOOK
92(c_preinclude,
93 "Define this hook to return the name of a header file to be included at\n\
94the 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\
96not defined, or the header is not found, or if the user specifies\n\
97@option{-ffreestanding} or @option{-nostdinc}, no header is included.\n\
98\n\
99This hook can be used together with a header provided by the system C\n\
100library to implement ISO C requirements for certain macros to be\n\
101predefined that describe properties of the whole implementation rather\n\
102than 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.\n\
109If this function returns true for the name of a file-scope function, that\n\
110function implicitly gets extern \"C\" linkage rather than whatever language\n\
111linkage the declaration would normally have. An example of such function\n\
112is WinMain on Win32 targets.",
113 bool, (const char*),
114 NULL)
115
116HOOK_VECTOR_END (C90_EMPTY_HACK)
117

source code of gcc/c-family/c-target.def