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