summaryrefslogtreecommitdiff
path: root/gcc/genhooks.c
diff options
context:
space:
mode:
authorjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>2011-04-06 11:08:17 +0000
committerjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>2011-04-06 11:08:17 +0000
commitc94b1d0eb368245668287fc40c9d24ef26e16a34 (patch)
tree8e4c7045bc87ed3ed6e71d6b4f137a6be8e21970 /gcc/genhooks.c
parentcd800728c05c142bde2035f188967bc42d6caa32 (diff)
downloadgcc-c94b1d0eb368245668287fc40c9d24ef26e16a34.tar.gz
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@172035 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/genhooks.c')
-rw-r--r--gcc/genhooks.c36
1 files changed, 21 insertions, 15 deletions
diff --git a/gcc/genhooks.c b/gcc/genhooks.c
index 6d924487938..89f60c9ce44 100644
--- a/gcc/genhooks.c
+++ b/gcc/genhooks.c
@@ -1,6 +1,6 @@
/* Process target.def to create initialization macros definition in
target-hooks-def.h and documentation in target-hooks.texi.
- Copyright (C) 2009, 2010 Free Software Foundation, Inc.
+ Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc.
This file is part of GCC.
@@ -22,17 +22,18 @@ along with GCC; see the file COPYING3. If not see
#include "hashtab.h"
#include "errors.h"
-struct hook_desc { const char *doc, *type, *name, *param, *init; };
+struct hook_desc { const char *doc, *type, *name, *param, *init, *docname; };
static struct hook_desc hook_array[] = {
-#define HOOK_VECTOR_1(NAME, FRAGMENT) \
- { 0, 0, #NAME, 0, 0 },
+#define HOOK_VECTOR_1(NAME, FRAGMENT) \
+ { 0, 0, #NAME, 0, 0, HOOK_TYPE },
#define DEFHOOKPOD(NAME, DOC, TYPE, INIT) \
- { DOC, #TYPE, HOOK_PREFIX #NAME, 0, #INIT },
+ { DOC, #TYPE, HOOK_PREFIX #NAME, 0, #INIT, HOOK_TYPE },
#define DEFHOOK(NAME, DOC, TYPE, PARAMS, INIT) \
- { DOC, #TYPE, HOOK_PREFIX #NAME, #PARAMS, #INIT },
+ { DOC, #TYPE, HOOK_PREFIX #NAME, #PARAMS, #INIT, HOOK_TYPE },
#define DEFHOOK_UNDOC(NAME, DOC, TYPE, PARAMS, INIT) \
- { "*", #TYPE, HOOK_PREFIX #NAME, #PARAMS, #INIT },
+ { "*", #TYPE, HOOK_PREFIX #NAME, #PARAMS, #INIT, HOOK_TYPE },
#include "target.def"
+#include "c-family/c-target.def"
#undef DEFHOOK
};
@@ -221,7 +222,7 @@ emit_documentation (const char *in_fname)
/* Print header. Function-valued hooks have a parameter list,
unlike POD-valued ones. */
deftype = hook_array[i].param ? "deftypefn" : "deftypevr";
- printf ("@%s {Target Hook} ", deftype);
+ printf ("@%s {%s} ", deftype, hook_array[i].docname);
if (strchr (hook_array[i].type, ' '))
printf ("{%s}", hook_array[i].type);
else
@@ -249,8 +250,9 @@ emit_documentation (const char *in_fname)
{
char *namex = upstrdup (hook_array[j].name);
- printf ("\n@%sx {Target Hook} {%s} %s",
- deftype, hook_array[j].type, namex);
+ printf ("\n@%sx {%s} {%s} %s",
+ deftype, hook_array[j].docname,
+ hook_array[j].type, namex);
}
if (hook_array[i].doc[0])
{
@@ -285,9 +287,10 @@ emit_documentation (const char *in_fname)
/* Emit #defines to stdout (this will be redirected to generate
target-hook-def.h) which set target hooks initializer macros
- to their default values. */
+ to their default values. These should only be emitted for hooks
+ whose type is given by DOCNAME. */
static void
-emit_init_macros (void)
+emit_init_macros (const char *docname)
{
int i;
const int MAX_NEST = 2;
@@ -299,6 +302,9 @@ emit_init_macros (void)
{
char *name = upstrdup (hook_array[i].name);
+ if (strcmp (hook_array[i].docname, docname) != 0)
+ continue;
+
if (!hook_array[i].type)
{
if (*name)
@@ -334,9 +340,9 @@ emit_init_macros (void)
int
main (int argc, char **argv)
{
- if (argc >= 2)
- emit_documentation (argv[1]);
+ if (argc >= 3)
+ emit_documentation (argv[2]);
else
- emit_init_macros ();
+ emit_init_macros (argv[1]);
return 0;
}