blob: 42146034fe967170e619069b35aa71fdb6933d1a [file] [log] [blame]
/* Target hook definitions for C-family front ends.
Copyright (C) 2001-2019 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3, or (at your option) any
later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
/* See target-hooks-macros.h for details of macros that should be
provided by the including file, and how to use them here. */
#include "target-hooks-macros.h"
#undef HOOK_TYPE
#define HOOK_TYPE "C Target Hook"
HOOK_VECTOR (TARGETCM_INITIALIZER, gcc_targetcm)
#undef HOOK_PREFIX
#define HOOK_PREFIX "TARGET_"
/* Handle target switch CODE (an OPT_* value). ARG is the argument
passed to the switch; it is NULL if no argument was. VALUE is the
value of ARG if CODE specifies a UInteger option, otherwise it is
1 if the positive form of the switch was used and 0 if the negative
form was. Return true if the switch was valid. */
DEFHOOK
(handle_c_option,
"",
bool, (size_t code, const char *arg, int value),
default_handle_c_option)
/* Targets may provide a string object type that can be used within
and between C, C++, and Objective-C dialects. */
DEFHOOK
(objc_construct_string_object,
"Targets may provide a string object type that can be used within\
and between C, C++ and their respective Objective-C dialects.\
A string object might, for example, embed encoding and length information.\
These objects are considered opaque to the compiler and handled as references.\
An ideal implementation makes the composition of the string object\
match that of the Objective-C @code{NSString} (@code{NXString} for GNUStep),\
allowing efficient interworking between C-only and Objective-C code.\
If a target implements string objects then this hook should return a\
reference to such an object constructed from the normal `C' string\
representation provided in @var{string}.\
At present, the hook is used by Objective-C only, to obtain a\
common-format string object when the target provides one.",
tree, (tree string),
NULL)
DEFHOOK
(objc_declare_unresolved_class_reference,
"Declare that Objective C class @var{classname} is referenced\
by the current TU.",
void, (const char *classname),
NULL)
DEFHOOK
(objc_declare_class_definition,
"Declare that Objective C class @var{classname} is defined\
by the current TU.",
void, (const char *classname),
NULL)
DEFHOOK
(string_object_ref_type_p,
"If a target implements string objects then this hook should return\
@code{true} if @var{stringref} is a valid reference to such an object.",
bool, (const_tree stringref),
hook_bool_const_tree_false)
DEFHOOK
(check_string_object_format_arg,
"If a target implements string objects then this hook should should\
provide a facility to check the function arguments in @var{args_list}\
against the format specifiers in @var{format_arg} where the type of\
@var{format_arg} is one recognized as a valid string reference type.",
void, (tree format_arg, tree args_list),
NULL)
DEFHOOK
(c_preinclude,
"Define this hook to return the name of a header file to be included at\
the start of all compilations, as if it had been included with\
@code{#include <@var{file}>}. If this hook returns @code{NULL}, or is\
not defined, or the header is not found, or if the user specifies\
@option{-ffreestanding} or @option{-nostdinc}, no header is included.\n\
\n\
This hook can be used together with a header provided by the system C\
library to implement ISO C requirements for certain macros to be\
predefined that describe properties of the whole implementation rather\
than just the compiler.",
const char *, (void),
hook_constcharptr_void_null)
DEFHOOK
(cxx_implicit_extern_c,
"Define this hook to add target-specific C++ implicit extern C functions.\
If this function returns true for the name of a file-scope function, that\
function implicitly gets extern \"C\" linkage rather than whatever language\
linkage the declaration would normally have. An example of such function\
is WinMain on Win32 targets.",
bool, (const char*),
NULL)
HOOK_VECTOR_END (C90_EMPTY_HACK)