gcc/gcc/target-hooks-macros.h
Joseph Myers acce4e7738 tm.texi.in: Document C target hooks as separate from general target hooks.
* doc/tm.texi.in: Document C target hooks as separate from general
	target hooks.
	* doc/tm.texi: Regenerate.
	* genhooks.c (struct hook_desc): Add docname field.
	(HOOK_VECTOR_1, DEFHOOKPOD, DEFHOOK, DEFHOOK_UNDOC).  Initialize
	docname field.
	(hook_array): Include c-target.def.
	(emit_documentation): Use docname field in output.
	(emit_init_macros): Take docname argument.  Only emit definitions
	for hooks matching docname.
	(main): Expect additional arguments in all cases.  Pass argument
	to emit_init_macros.
	* target.def: Move initial macro definitions and comments to
	target-hooks-macros.h.
	(gcc_targetcm): Move to c-family/c-target.def.
	* target.h (targetcm): Move declaration to c-family/c-target.h.
	* targhooks.c (default_handle_c_option): Move to
	c-family/c-opts.c.
	* targhooks.h (default_handle_c_option): Move declaration to
	c-family/c-common.h.
	* target-hooks-macros.h: New file.
	* config.gcc (target_has_targetcm): Define and use to add to
	c_target_objs and cxx_target_objs.
	* config/default-c.c: New file.
	* config/darwin-c.c: Include c-target.h and c-target-def.h instead
	of target.h and target-def.h.
	(TARGET_HANDLE_C_OPTION, targetcm): Define later in file.
	(darwin_objc_construct_string, darwin_cfstring_ref_p,
	darwin_check_cfstring_format_arg): Make static.
	(TARGET_OBJC_CONSTRUCT_STRING_OBJECT,
	TARGET_STRING_OBJECT_REF_TYPE_P,
	TARGET_CHECK_STRING_OBJECT_FORMAT_ARG): Define here.
	* config/darwin-protos.h (darwin_objc_construct_string,
	darwin_cfstring_ref_p, darwin_check_cfstring_format_arg): Don't
	declare.
	* config/darwin.h (TARGET_OBJC_CONSTRUCT_STRING_OBJECT,
	TARGET_STRING_OBJECT_REF_TYPE_P,
	TARGET_CHECK_STRING_OBJECT_FORMAT_ARG, TARGET_HAS_TARGETCM):
	Remove.
	* config/t-darwin (darwin-c.o): Update dependencies.
	* system.h (TARGET_HAS_TARGETCM): Poison.
	* Makefile.in (TARGET_H): Update.
	(TARGET_DEF, C_TARGET_DEF, C_TARGET_H, C_TARGET_DEF_H): Define.
	(c-family/c-format.o, c-family/c-opts.o): Update dependencies.
	(default-c.o): New target.
	(s-target-hooks-def-h): Pass "Target Hook" string to genhooks.
	(c-family/c-target-hooks-def.h, s-c-target-hooks-def-h): New
	targets.
	(s-tm-texi): Pass -d option to genhooks.  Also test timestamp on
	c-target.def.
	(build/genhooks.o): Update dependencies.

c-family:
	* c-target-def.h: New file.
	* c-target.def: New file.
	* c-target.h: New file.
	* c-common.c (targetcm): Don't define here.
	* c-common.h (default_handle_c_option): Declare.
	* c-format.c: Include c-target.h instead of target.h.
	* c-opts.c: Include c-target.h instead of target.h.  Explicitly
	include tm.h.
	(default_handle_c_option): Move from targhooks.c.

objc:
	* objc-act.c: Include c-target.h instead of target.h.
	* Make-lang.in (objc/objc-act.o): Update dependencies.

From-SVN: r172035
2011-04-06 12:08:17 +01:00

83 lines
4.0 KiB
C

/* Common macros for target hook definitions.
Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
2011
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/>. */
/* The following macros should be provided by the including file:
DEFHOOK(NAME, DOC, TYPE, PARAMS, INIT): Define a function-valued hook.
DEFHOOKPOD(DOC, TYPE, NAME, INIT): Define a piece-of-data 'hook'. */
/* Defaults for optional macros:
DEFHOOKPODX(NAME, TYPE, INIT): Like DEFHOOKPOD, but share documentation
with the previous 'hook'. */
#ifndef DEFHOOKPODX
#define DEFHOOKPODX(NAME, TYPE, INIT) DEFHOOKPOD (NAME, 0, TYPE, INIT)
#endif
/* HOOKSTRUCT(FRAGMENT): Declarator fragments to encapsulate all the
members into a struct gcc_target, which in turn contains several
sub-structs. */
#ifndef HOOKSTRUCT
#define HOOKSTRUCT(FRAGMENT)
#endif
/* HOOK_VECTOR: Start a struct declaration, which then gets its own initializer.
HOOK_VECTOR_END: Close a struct declaration, providing a member declarator
name for nested use. */
#ifndef HOOK_VECTOR_1
#define HOOK_VECTOR_1(NAME, FRAGMENT) HOOKSTRUCT(FRAGMENT)
#endif
#define HOOK_VECTOR(INIT_NAME, SNAME) HOOK_VECTOR_1 (INIT_NAME, struct SNAME {)
#define HOOK_VECTOR_END(DECL_NAME) HOOK_VECTOR_1(,} DECL_NAME ;)
/* FIXME: For pre-existing hooks, we can't place the documentation in the
documentation field here till we get permission from the FSF to include
it in GPLed software - the target hook documentation is so far only
available under the GFDL. */
/* A hook should generally be documented by a string in the DOC parameter,
which should contain texinfo markup. If the documentation is only available
under the GPL, but not under the GFDL, put it in a comment above the hook
definition. If the function declaration is available both under GPL and
GFDL, but the documentation is only available under the GFDL, put the
documentaton in tm.texi.in, heading with @hook <hookname> and closing
the paragraph with @end deftypefn / deftypevr as appropriate, and marking
the next autogenerated hook with @hook <hookname>.
In both these cases, leave the DOC string empty, i.e. "".
Sometimes, for some historic reason the function declaration
has to be documented differently
than what it is. In that case, use DEFHOOK_UNDOC to supress auto-generation
of documentation. DEFHOOK_UNDOC takes a DOC string which it ignores, so
you can put GPLed documentation string there if you have hopes that you
can clear the declaration & documentation for GFDL distribution later,
in which case you can then simply change the DEFHOOK_UNDOC to DEFHOOK
to turn on the autogeneration of the documentation.
A documentation string of "*" means not to emit any documentation at all,
and is mainly used internally for DEFHOOK_UNDOC. It should generally not
be used otherwise, but it has its use for exceptional cases where automatic
documentation is not wanted, and the real documentation is elsewere, like
for TARGET_ASM_{,UN}ALIGNED_INT_OP, which are hooks only for implementation
purposes; they refer to structs, the components of which are documented as
separate hooks TARGET_ASM_{,UN}ALIGNED_[HSDT]I_OP.
A DOC string of 0 is for internal use of DEFHOOKPODX and special table
entries only. */
/* Empty macro arguments are undefined in C90, so use an empty macro
to close top-level hook structures. */
#define C90_EMPTY_HACK