* doc/tm.texi.in: Document C target hooks as separate from general
authorjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 6 Apr 2011 11:08:17 +0000 (11:08 +0000)
committerjsm28 <jsm28@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 6 Apr 2011 11:08:17 +0000 (11:08 +0000)
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

28 files changed:
gcc/ChangeLog
gcc/Makefile.in
gcc/c-family/ChangeLog
gcc/c-family/c-common.c
gcc/c-family/c-common.h
gcc/c-family/c-format.c
gcc/c-family/c-opts.c
gcc/c-family/c-target-def.h [new file with mode: 0644]
gcc/c-family/c-target.def [new file with mode: 0644]
gcc/c-family/c-target.h [new file with mode: 0644]
gcc/config.gcc
gcc/config/darwin-c.c
gcc/config/darwin-protos.h
gcc/config/darwin.h
gcc/config/default-c.c [new file with mode: 0644]
gcc/config/t-darwin
gcc/doc/tm.texi
gcc/doc/tm.texi.in
gcc/genhooks.c
gcc/objc/ChangeLog
gcc/objc/Make-lang.in
gcc/objc/objc-act.c
gcc/system.h
gcc/target-hooks-macros.h [new file with mode: 0644]
gcc/target.def
gcc/target.h
gcc/targhooks.c
gcc/targhooks.h

index bc8a071..f413ed2 100644 (file)
@@ -1,3 +1,57 @@
+2011-04-06  Joseph Myers  <joseph@codesourcery.com>
+
+       * 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.
+
 2011-04-06  Richard Guenther  <rguenther@suse.de>
  
        * ipa-inline.c (enum inlining_mode): Remove.
index d47a69e..2ff21e2 100644 (file)
@@ -873,12 +873,17 @@ endif
 # Shorthand variables for dependency lists.
 VEC_H = vec.h statistics.h
 EXCEPT_H = except.h $(HASHTAB_H) vecprim.h vecir.h
-TARGET_H = $(TM_H) target.h target.def insn-modes.h
+TARGET_DEF = target.def target-hooks-macros.h
+C_TARGET_DEF = c-family/c-target.def target-hooks-macros.h
+TARGET_H = $(TM_H) target.h $(TARGET_DEF) insn-modes.h
+C_TARGET_H = c-family/c-target.h $(C_TARGET_DEF)
 MACHMODE_H = machmode.h mode-classes.def insn-modes.h
 HOOKS_H = hooks.h $(MACHMODE_H)
 HOSTHOOKS_DEF_H = hosthooks-def.h $(HOOKS_H)
 LANGHOOKS_DEF_H = langhooks-def.h $(HOOKS_H)
 TARGET_DEF_H = target-def.h target-hooks-def.h $(HOOKS_H) targhooks.h
+C_TARGET_DEF_H = c-family/c-target-def.h c-family/c-target-hooks-def.h \
+  $(TREE_H) $(C_COMMON_H) $(HOOKS_H)
 RTL_BASE_H = rtl.h rtl.def $(MACHMODE_H) reg-notes.def insn-notes.def \
   $(INPUT_H) $(REAL_H) statistics.h $(VEC_H) $(FIXED_VALUE_H) alias.h \
   $(HASHTAB_H)
@@ -2110,7 +2115,7 @@ c-family/c-dump.o : c-family/c-dump.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
 
 c-family/c-format.o : c-family/c-format.c c-family/c-format.h \
        $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) langhooks.h \
-       $(C_COMMON_H) $(FLAGS_H) intl.h \
+       $(C_COMMON_H) $(FLAGS_H) intl.h $(C_TARGET_H) \
        $(DIAGNOSTIC_CORE_H) alloc-pool.h c-family/c-objc.h
 
 c-family/c-gimplify.o : c-family/c-gimplify.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) \
@@ -2129,7 +2134,7 @@ c-family/c-omp.o : c-family/c-omp.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
 
 c-family/c-opts.o : c-family/c-opts.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
         $(TREE_H) $(C_PRAGMA_H) $(FLAGS_H) toplev.h langhooks.h \
-        $(DIAGNOSTIC_H) intl.h debug.h $(C_COMMON_H)   \
+        $(DIAGNOSTIC_H) intl.h debug.h $(C_COMMON_H) $(C_TARGET_H) \
         $(OPTS_H) $(OPTIONS_H) $(MKDEPS_H) incpath.h cppdefault.h
        $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) \
                $< $(OUTPUT_OPTION) @TARGET_SYSTEM_ROOT_DEFINE@
@@ -2168,6 +2173,10 @@ c-family/c-ada-spec.o : c-family/c-ada-spec.c c-family/c-ada-spec.h \
 c-family/stub-objc.o : c-family/stub-objc.c $(CONFIG_H) $(SYSTEM_H) \
        coretypes.h $(TREE_H) $(C_COMMON_H) c-family/c-objc.h
 
+default-c.o: config/default-c.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
+  $(C_TARGET_H) $(C_TARGET_DEF_H)
+       $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) \
+         $< $(OUTPUT_OPTION)
 
 # Files used by all variants of C and some other languages.
 
@@ -3659,11 +3668,21 @@ target-hooks-def.h: s-target-hooks-def-h; @true
 $(srcdir)/doc/tm.texi: s-tm-texi; @true
 
 s-target-hooks-def-h: build/genhooks$(build_exeext)
-       $(RUN_GEN) build/genhooks$(build_exeext) > tmp-target-hooks-def.h
+       $(RUN_GEN) build/genhooks$(build_exeext) "Target Hook" \
+                                            > tmp-target-hooks-def.h
        $(SHELL) $(srcdir)/../move-if-change tmp-target-hooks-def.h \
                                             target-hooks-def.h
        $(STAMP) s-target-hooks-def-h
 
+c-family/c-target-hooks-def.h: s-c-target-hooks-def-h; @true
+
+s-c-target-hooks-def-h: build/genhooks$(build_exeext)
+       $(RUN_GEN) build/genhooks$(build_exeext) "C Target Hook" \
+                                            > tmp-c-target-hooks-def.h
+       $(SHELL) $(srcdir)/../move-if-change tmp-c-target-hooks-def.h \
+                                            c-family/c-target-hooks-def.h
+       $(STAMP) s-c-target-hooks-def-h
+
 # check if someone mistakenly only changed tm.texi.
 # We use a different pathname here to avoid a circular dependency.
 s-tm-texi: $(srcdir)/doc/../doc/tm.texi
@@ -3673,7 +3692,7 @@ s-tm-texi: $(srcdir)/doc/../doc/tm.texi
 # \r is not portable to Solaris tr, therefore we have a special
 # case for ASCII.  We use \r for other encodings like EBCDIC.
 s-tm-texi: build/genhooks$(build_exeext) $(srcdir)/doc/tm.texi.in
-       $(RUN_GEN) build/genhooks$(build_exeext) \
+       $(RUN_GEN) build/genhooks$(build_exeext) -d \
                        $(srcdir)/doc/tm.texi.in > tmp-tm.texi
        case `echo X|tr X '\101'` in \
          A) tr -d '\015' < tmp-tm.texi > tmp2-tm.texi ;; \
@@ -3684,7 +3703,9 @@ s-tm-texi: build/genhooks$(build_exeext) $(srcdir)/doc/tm.texi.in
        @if cmp -s $(srcdir)/doc/tm.texi tm.texi; then \
          $(STAMP) $@; \
        elif test $(srcdir)/doc/tm.texi -nt $(srcdir)/doc/tm.texi.in \
-         && test $(srcdir)/doc/tm.texi -nt $(srcdir)/target.def; then \
+         && ( test $(srcdir)/doc/tm.texi -nt $(srcdir)/target.def \
+           || test $(srcdir)/doc/tm.texi -nt $(srcdir)/c-family/c-target.def \
+         ); then \
          echo >&2 ; \
          echo You should edit $(srcdir)/doc/tm.texi.in rather than $(srcdir)/doc/tm.texi . >&2 ; \
          false; \
@@ -3897,7 +3918,8 @@ build/genpreds.o : genpreds.c $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H)      \
   coretypes.h $(GTM_H) errors.h $(READ_MD_H) gensupport.h $(OBSTACK_H)
 build/genrecog.o : genrecog.c $(RTL_BASE_H) $(BCONFIG_H) $(SYSTEM_H)   \
   coretypes.h $(GTM_H) errors.h $(READ_MD_H) gensupport.h
-build/genhooks.o : genhooks.c target.def $(BCONFIG_H) $(SYSTEM_H) errors.h
+build/genhooks.o : genhooks.c $(TARGET_DEF) $(C_TARGET_DEF)            \
+  $(BCONFIG_H) $(SYSTEM_H) errors.h
 
 # Compile the programs that generate insn-* from the machine description.
 # They are compiled with $(COMPILER_FOR_BUILD), and associated libraries,
index 0250435..a7efe84 100644 (file)
@@ -1,3 +1,15 @@
+2011-04-06  Joseph Myers  <joseph@codesourcery.com>
+
+       * 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.
+
 2011-03-29  Jakub Jelinek  <jakub@redhat.com>
 
        PR preprocessor/48248
index cab9e7e..1252b18 100644 (file)
@@ -9252,10 +9252,6 @@ warn_for_unused_label (tree label)
     }
 }
 
-#ifndef TARGET_HAS_TARGETCM
-struct gcc_targetcm targetcm = TARGETCM_INITIALIZER;
-#endif
-
 /* Warn for division by zero according to the value of DIVISOR.  LOC
    is the location of the division operator.  */
 
index 6046d3e..91e21ff 100644 (file)
@@ -700,6 +700,7 @@ extern tree handle_format_arg_attribute (tree *, tree, tree, int, bool *);
 extern bool attribute_takes_identifier_p (const_tree);
 extern bool c_common_handle_option (size_t, const char *, int, int, location_t,
                                    const struct cl_option_handlers *);
+extern bool default_handle_c_option (size_t, const char *, int);
 extern tree c_common_type_for_mode (enum machine_mode, int);
 extern tree c_common_type_for_size (unsigned int, int);
 extern tree c_common_fixed_point_type_for_size (unsigned int, unsigned int,
index 85831eb..801e434 100644 (file)
@@ -1,6 +1,6 @@
 /* Check calls to formatted I/O functions (-Wformat).
    Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
-   2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010
+   2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011
    Free Software Foundation, Inc.
 
 This file is part of GCC.
@@ -32,7 +32,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "langhooks.h"
 #include "c-format.h"
 #include "alloc-pool.h"
-#include "target.h"
+#include "c-target.h"
 \f
 /* Set format warning options according to a -Wformat=n option.  */
 
index 8d6e6e7..dd87591 100644 (file)
@@ -36,7 +36,12 @@ along with GCC; see the file COPYING3.  If not see
 #include "opts.h"
 #include "options.h"
 #include "mkdeps.h"
-#include "target.h"            /* For gcc_targetcm.  */
+#include "c-target.h"
+#include "tm.h"                        /* For BYTES_BIG_ENDIAN,
+                                  DOLLARS_IN_IDENTIFIERS,
+                                  STDC_0_IN_SYSTEM_HEADERS,
+                                  TARGET_FLT_EVAL_METHOD_NON_DEFAULT and
+                                  TARGET_OPTF.  */
 #include "tm_p.h"              /* For C_COMMON_OVERRIDE_OPTIONS.  */
 
 #ifndef DOLLARS_IN_IDENTIFIERS
@@ -809,6 +814,16 @@ c_common_handle_option (size_t scode, const char *arg, int value,
   return result;
 }
 
+/* Default implementation of TARGET_HANDLE_C_OPTION.  */
+
+bool
+default_handle_c_option (size_t code ATTRIBUTE_UNUSED,
+                        const char *arg ATTRIBUTE_UNUSED,
+                        int value ATTRIBUTE_UNUSED)
+{
+  return false;
+}
+
 /* Post-switch processing.  */
 bool
 c_common_post_options (const char **pfilename)
diff --git a/gcc/c-family/c-target-def.h b/gcc/c-family/c-target-def.h
new file mode 100644 (file)
index 0000000..00bdc25
--- /dev/null
@@ -0,0 +1,22 @@
+/* Default initializers for C-family target hooks.
+   Copyright (C) 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/>.  */
+
+#include "c-family/c-target-hooks-def.h"
+#include "tree.h"
+#include "c-family/c-common.h"
+#include "hooks.h"
diff --git a/gcc/c-family/c-target.def b/gcc/c-family/c-target.def
new file mode 100644 (file)
index 0000000..356fe26
--- /dev/null
@@ -0,0 +1,79 @@
+/* Target hook definitions for C-family front ends.
+   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/>.  */
+
+/* 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
+(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)
+HOOK_VECTOR_END (C90_EMPTY_HACK)
diff --git a/gcc/c-family/c-target.h b/gcc/c-family/c-target.h
new file mode 100644 (file)
index 0000000..69ca4dd
--- /dev/null
@@ -0,0 +1,37 @@
+/* Data structure definitions for target-specific C-family behavior.
+   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/>.
+
+   In other words, you are welcome to use, share and improve this program.
+   You are forbidden to forbid anyone else to use, share and improve
+   what you give them.   Help stamp out software-hoarding!  */
+
+#ifndef GCC_C_TARGET_H
+#define GCC_C_TARGET_H
+
+#define DEFHOOKPOD(NAME, DOC, TYPE, INIT) TYPE NAME;
+#define DEFHOOK(NAME, DOC, TYPE, PARAMS, INIT) TYPE (* NAME) PARAMS;
+#define DEFHOOK_UNDOC DEFHOOK
+#define HOOKSTRUCT(FRAGMENT) FRAGMENT
+
+#include "c-target.def"
+
+/* Each target can provide their own.  */
+extern struct gcc_targetcm targetcm;
+
+#endif /* GCC_C_TARGET_H */
index d40ad44..811b8e1 100644 (file)
 #
 #  gnu_ld              Set to yes or no depending on whether the target
 #                      system normally uses GNU ld.
+#
+#  target_has_targetcm Set to yes or no depending on whether the target
+#                      has its own definition of targetcm.
 
 out_file=
 tmake_file=
@@ -200,6 +203,7 @@ extra_options=
 c_target_objs=
 cxx_target_objs=
 fortran_target_objs=
+target_has_targetcm=no
 tm_defines=
 xm_defines=
 # Set this to force installation and use of collect2.
@@ -478,6 +482,7 @@ case ${target} in
   c_target_objs="${c_target_objs} darwin-c.o"
   cxx_target_objs="${cxx_target_objs} darwin-c.o"
   fortran_target_objs="darwin-f.o"
+  target_has_targetcm=yes
   extra_objs="darwin.o"
   extra_gcc_objs="darwin-driver.o"
   default_use_cxa_atexit=yes
@@ -2661,6 +2666,11 @@ powerpc*-*-* | rs6000-*-*)
        tm_file="${tm_file} rs6000/option-defaults.h"
 esac
 
+if [ "$target_has_targetcm" = "no" ]; then
+  c_target_objs="$c_target_objs default-c.o"
+  cxx_target_objs="$cxx_target_objs default-c.o"
+fi
+
 # Support for --with-cpu and related options (and a few unrelated options,
 # too).
 case ${with_cpu} in
index 0c713ba..08de2f8 100644 (file)
@@ -1,5 +1,5 @@
 /* Darwin support needed only by C/C++ frontends.
-   Copyright (C) 2001, 2003, 2004, 2005, 2007, 2008, 2010
+   Copyright (C) 2001, 2003, 2004, 2005, 2007, 2008, 2010, 2011
    Free Software Foundation, Inc.
    Contributed by Apple Computer Inc.
 
@@ -34,8 +34,8 @@ along with GCC; see the file COPYING3.  If not see
 #include "tm_p.h"
 #include "cppdefault.h"
 #include "prefix.h"
-#include "target.h"
-#include "target-def.h"
+#include "c-family/c-target.h"
+#include "c-family/c-target-def.h"
 
 /* Pragmas.  */
 
@@ -660,13 +660,8 @@ handle_c_option (size_t code,
   return true;
 }
 
-#undef TARGET_HANDLE_C_OPTION
-#define TARGET_HANDLE_C_OPTION handle_c_option
-
-struct gcc_targetcm targetcm = TARGETCM_INITIALIZER;
-
 /* Allow ObjC* access to CFStrings.  */
-tree
+static tree
 darwin_objc_construct_string (tree str)
 {
   if (!darwin_constant_cfstrings)
@@ -685,7 +680,7 @@ darwin_objc_construct_string (tree str)
 /* The string ref type is created as CFStringRef by <CFBase.h> therefore, we
    must match for it explicitly, since it's outside the gcc code.  */
 
-bool
+static bool
 darwin_cfstring_ref_p (const_tree strp)
 {
   tree tn;
@@ -701,7 +696,7 @@ darwin_cfstring_ref_p (const_tree strp)
 }
 
 /* At present the behavior of this is undefined and it does nothing.  */
-void
+static void
 darwin_check_cfstring_format_arg (tree ARG_UNUSED (format_arg), 
                                  tree ARG_UNUSED (args_list))
 {
@@ -715,3 +710,17 @@ EXPORTED_CONST format_kind_info darwin_additional_format_types[] = {
     NULL, NULL
   }
 };
+
+#undef TARGET_HANDLE_C_OPTION
+#define TARGET_HANDLE_C_OPTION handle_c_option
+
+#undef TARGET_OBJC_CONSTRUCT_STRING_OBJECT
+#define TARGET_OBJC_CONSTRUCT_STRING_OBJECT darwin_objc_construct_string
+
+#undef TARGET_STRING_OBJECT_REF_TYPE_P
+#define TARGET_STRING_OBJECT_REF_TYPE_P darwin_cfstring_ref_p
+
+#undef TARGET_CHECK_STRING_OBJECT_FORMAT_ARG
+#define TARGET_CHECK_STRING_OBJECT_FORMAT_ARG darwin_check_cfstring_format_arg
+
+struct gcc_targetcm targetcm = TARGETCM_INITIALIZER;
index 4a99611..150230d 100644 (file)
@@ -1,5 +1,5 @@
 /* Prototypes.
-   Copyright (C) 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2010
+   Copyright (C) 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2010, 2011
    Free Software Foundation, Inc.
 
 This file is part of GCC.
@@ -112,10 +112,7 @@ extern void darwin_cpp_builtins (struct cpp_reader *);
 
 extern tree darwin_init_cfstring_builtins (unsigned);
 extern tree darwin_fold_builtin (tree, int, tree *, bool);
-extern tree darwin_objc_construct_string (tree);
 extern bool darwin_cfstring_p (tree);
-extern bool darwin_cfstring_ref_p (const_tree);
-extern void darwin_check_cfstring_format_arg (tree, tree);
 extern tree darwin_build_constant_cfstring (tree);
 extern void darwin_enter_string_into_cfstring_table (tree);
 
index 2f5b638..4725015 100644 (file)
@@ -965,20 +965,9 @@ __enable_execute_stack (void *addr)                                     \
 /* We have target-specific builtins.  */
 #define TARGET_FOLD_BUILTIN darwin_fold_builtin
 
-#define TARGET_OBJC_CONSTRUCT_STRING_OBJECT \
-  darwin_objc_construct_string
-
-#define TARGET_STRING_OBJECT_REF_TYPE_P \
-  darwin_cfstring_ref_p
-
 #define TARGET_N_FORMAT_TYPES 1
 #define TARGET_FORMAT_TYPES darwin_additional_format_types
 
-#define TARGET_CHECK_STRING_OBJECT_FORMAT_ARG \
-  darwin_check_cfstring_format_arg
-
-#define TARGET_HAS_TARGETCM 1
-
 #ifndef USED_FOR_TARGET
 extern void darwin_driver_init (unsigned int *,struct cl_decoded_option **);
 #define GCC_DRIVER_HOST_INITIALIZATION \
diff --git a/gcc/config/default-c.c b/gcc/config/default-c.c
new file mode 100644 (file)
index 0000000..7ca3d87
--- /dev/null
@@ -0,0 +1,34 @@
+/* Default C-family target hooks initializer.
+   Copyright (C) 2011
+   Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC 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.
+
+GCC 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 GCC; see the file COPYING3.  If not see
+<http://www.gnu.org/licenses/>.  */
+
+#include "config.h"
+#include "system.h"
+#include "coretypes.h"
+#include "c-family/c-target.h"
+#include "c-family/c-target-def.h"
+
+/* Do not include tm.h or tm_p.h here; if it is useful for a target to
+   define some macros for the initializer in a header without defining
+   targetcm itself (for example, because of interactions with some
+   hooks depending on the target OS and others on the target
+   architecture), create a separate tm_c.h for only the relevant
+   definitions.  */
+
+struct gcc_targetcm targetcm = TARGETCM_INITIALIZER;
index ff60787..1faafbe 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+# Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
 # Free Software Foundation, Inc.
 #
 # This file is part of GCC.
@@ -29,7 +29,7 @@ darwin.o: $(srcdir)/config/darwin.c $(CONFIG_H) $(SYSTEM_H) coretypes.h     \
 
 darwin-c.o: $(srcdir)/config/darwin-c.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
   $(TM_H) $(CPPLIB_H) $(TREE_H) $(C_PRAGMA_H) $(TM_P_H) \
-  incpath.h flags.h $(C_COMMON_H)
+  incpath.h flags.h $(C_COMMON_H) $(C_TARGET_H) $(C_TARGET_DEF_H)
        $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \
                $(srcdir)/config/darwin-c.c $(PREPROCESSOR_DEFINES)
 
index e036a75..e5938fe 100644 (file)
@@ -91,6 +91,14 @@ form part of the @code{targetm} structure, it is documented below as a
 from being defined in the @file{.h} file to being part of the
 @code{targetm} structure.
 
+Similarly, there is a @code{targetcm} variable for hooks that are
+specific to front ends for C-family languages, documented as ``C
+Target Hook''.  This is declared in @file{c-family/c-target.h}, the
+the initializer @code{TARGETCM_INITIALIZER} in
+@file{c-family/c-target-def.h}.  If targets initialize @code{targetcm}
+themselves, they should set @code{target_has_targetcm=yes} in
+@file{config.gcc}; otherwise a default definition is used.
+
 @node Driver
 @section Controlling the Compilation Driver, @file{gcc}
 @cindex driver
@@ -678,7 +686,7 @@ option was passed (@code{UNKNOWN_LOCATION} except for options passed
 via attributes).
 @end deftypefn
 
-@deftypefn {Target Hook} bool TARGET_HANDLE_C_OPTION (size_t @var{code}, const char *@var{arg}, int @var{value})
+@deftypefn {Target Hook} bool TARGET_HANDLE_C_OPTION (size_t @var{code}, const char *@var{arg}, int @var{value})
 This target hook is called whenever the user specifies one of the
 target-specific C language family options described by the @file{.opt}
 definition files(@pxref{Options}).  It has the opportunity to do some
@@ -692,15 +700,15 @@ only available in the C (and related language) front ends, then you
 should use @code{TARGET_HANDLE_C_OPTION} instead.
 @end deftypefn
 
-@deftypefn {Target Hook} tree TARGET_OBJC_CONSTRUCT_STRING_OBJECT (tree @var{string})
+@deftypefn {Target Hook} tree TARGET_OBJC_CONSTRUCT_STRING_OBJECT (tree @var{string})
 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.
 @end deftypefn
 
-@deftypefn {Target Hook} bool TARGET_STRING_OBJECT_REF_TYPE_P (const_tree @var{stringref})
+@deftypefn {Target Hook} bool TARGET_STRING_OBJECT_REF_TYPE_P (const_tree @var{stringref})
 If a target implements string objects then this hook should return @code{true} if @var{stringref} is a valid reference to such an object.
 @end deftypefn
 
-@deftypefn {Target Hook} void TARGET_CHECK_STRING_OBJECT_FORMAT_ARG (tree @var{format_arg}, tree @var{args_list})
+@deftypefn {Target Hook} void TARGET_CHECK_STRING_OBJECT_FORMAT_ARG (tree @var{format_arg}, tree @var{args_list})
 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.
 @end deftypefn
 
index 867006f..27949d1 100644 (file)
@@ -91,6 +91,14 @@ form part of the @code{targetm} structure, it is documented below as a
 from being defined in the @file{.h} file to being part of the
 @code{targetm} structure.
 
+Similarly, there is a @code{targetcm} variable for hooks that are
+specific to front ends for C-family languages, documented as ``C
+Target Hook''.  This is declared in @file{c-family/c-target.h}, the
+the initializer @code{TARGETCM_INITIALIZER} in
+@file{c-family/c-target-def.h}.  If targets initialize @code{targetcm}
+themselves, they should set @code{target_has_targetcm=yes} in
+@file{config.gcc}; otherwise a default definition is used.
+
 @node Driver
 @section Controlling the Compilation Driver, @file{gcc}
 @cindex driver
index 6d92448..89f60c9 100644 (file)
@@ -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;
 }
index 5194347..5e0d5ab 100644 (file)
@@ -1,3 +1,8 @@
+2011-04-06  Joseph Myers  <joseph@codesourcery.com>
+
+       * objc-act.c: Include c-target.h instead of target.h.
+       * Make-lang.in (objc/objc-act.o): Update dependencies.
+
 2011-03-06  Joseph Myers  <joseph@codesourcery.com>
 
        * lang-specs.h: Match -save-temps* instead of -save-temps.
index 6544bcc..182ebf4 100644 (file)
@@ -98,7 +98,8 @@ objc/objc-next-runtime-abi-02.o: objc/objc-next-runtime-abi-02.c $(START_HDRS) \
 objc/objc-act.o : objc/objc-act.c $(START_HDRS) $(GGC_H) \
    $(DIAGNOSTIC_CORE_H) toplev.h $(FLAGS_H) input.h $(FUNCTION_H) output.h debug.h \
    $(LANGHOOKS_DEF_H) $(HASHTAB_H) $(C_PRAGMA_H) gt-objc-objc-act.h $(OBSTACK_H) \
-   $(GIMPLE_H) objc/objc-runtime-shared-support.h objc/objc-runtime-hooks.h
+   $(GIMPLE_H) objc/objc-runtime-shared-support.h objc/objc-runtime-hooks.h \
+   $(C_TARGET_H)
 
 objc.srcextra:
 
index 4511435..26a5aa9 100644 (file)
@@ -46,7 +46,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "toplev.h"
 #include "ggc.h"
 #include "debug.h"
-#include "target.h"
+#include "c-family/c-target.h"
 #include "diagnostic-core.h"
 #include "intl.h"
 #include "cgraph.h"
index ba07cd8..c611fed 100644 (file)
@@ -830,7 +830,7 @@ extern void fancy_abort (const char *, int, const char *) ATTRIBUTE_NORETURN;
        FUNCTION_ARG_BOUNDARY MUST_USE_SJLJ_EXCEPTIONS US_SOFTWARE_GOFAST  \
        USING_SVR4_H SVR4_ASM_SPEC FUNCTION_ARG FUNCTION_ARG_ADVANCE       \
        FUNCTION_INCOMING_ARG IRA_COVER_CLASSES TARGET_VERSION             \
-       MACHINE_TYPE
+       MACHINE_TYPE TARGET_HAS_TARGETCM
 
 /* Hooks that are no longer used.  */
  #pragma GCC poison LANG_HOOKS_FUNCTION_MARK LANG_HOOKS_FUNCTION_FREE  \
diff --git a/gcc/target-hooks-macros.h b/gcc/target-hooks-macros.h
new file mode 100644 (file)
index 0000000..3ef5ae3
--- /dev/null
@@ -0,0 +1,82 @@
+/* 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
index b11c0c0..b25ca27 100644 (file)
    You are forbidden to forbid anyone else to use, share and improve
    what you give them.   Help stamp out software-hoarding!  */
 
-/* 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 ;)
+/* 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"
 
-HOOK_VECTOR (TARGET_INITIALIZER, gcc_target)
+#undef HOOK_TYPE
+#define HOOK_TYPE "Target Hook"
 
-/* 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.  */
+HOOK_VECTOR (TARGET_INITIALIZER, gcc_target)
 
 /* Functions that output assembler for the target.  */
 #define HOOK_PREFIX "TARGET_ASM_"
@@ -2715,58 +2662,5 @@ DEFHOOKPOD
 
 /* Leave the boolean fields at the end.  */
 
-/* Empty macro arguments are undefined in C90, so use an empty macro.  */
-#define C90_EMPTY_HACK
 /* Close the 'struct gcc_target' definition.  */
 HOOK_VECTOR_END (C90_EMPTY_HACK)
-
-HOOK_VECTOR (TARGETCM_INITIALIZER, gcc_targetcm)
-
-/* 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
-(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)
-HOOK_VECTOR_END (C90_EMPTY_HACK)
index eaf7aad..eae0b76 100644 (file)
@@ -176,7 +176,4 @@ struct default_options
 
 extern struct gcc_target targetm;
 
-/* Each target can provide their own.  */
-extern struct gcc_targetcm targetcm;
-
 #endif /* GCC_TARGET_H */
index a54b1c7..419f6b1 100644 (file)
@@ -930,14 +930,6 @@ default_secondary_reload (bool in_p ATTRIBUTE_UNUSED, rtx x ATTRIBUTE_UNUSED,
   return rclass;
 }
 
-bool
-default_handle_c_option (size_t code ATTRIBUTE_UNUSED,
-                        const char *arg ATTRIBUTE_UNUSED,
-                        int value ATTRIBUTE_UNUSED)
-{
-  return false;
-}
-
 /* By default, if flag_pic is true, then neither local nor global relocs
    should be placed in readonly memory.  */
 
index 8ad8134..93f86bf 100644 (file)
@@ -129,7 +129,6 @@ extern reg_class_t default_secondary_reload (bool, rtx, reg_class_t,
                                             secondary_reload_info *);
 extern void default_target_option_override (void);
 extern void hook_void_bitmap (bitmap);
-extern bool default_handle_c_option (size_t, const char *, int);
 extern int default_reloc_rw_mask (void);
 extern tree default_mangle_decl_assembler_name (tree, tree);
 extern tree default_emutls_var_fields (tree, tree *);