aboutsummaryrefslogtreecommitdiff
path: root/gcc/config
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2011-04-06 12:08:17 +0100
committerJoseph Myers <jsm28@gcc.gnu.org>2011-04-06 12:08:17 +0100
commitacce4e77382b198a70f1044724bda19b01997657 (patch)
tree8e4c7045bc87ed3ed6e71d6b4f137a6be8e21970 /gcc/config
parent275b4baa7103f181bf0d7a7e3b97497d6b678ce6 (diff)
downloadgcc-acce4e77382b198a70f1044724bda19b01997657.zip
gcc-acce4e77382b198a70f1044724bda19b01997657.tar.gz
gcc-acce4e77382b198a70f1044724bda19b01997657.tar.bz2
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
Diffstat (limited to 'gcc/config')
-rw-r--r--gcc/config/darwin-c.c31
-rw-r--r--gcc/config/darwin-protos.h5
-rw-r--r--gcc/config/darwin.h11
-rw-r--r--gcc/config/default-c.c34
-rw-r--r--gcc/config/t-darwin4
5 files changed, 57 insertions, 28 deletions
diff --git a/gcc/config/darwin-c.c b/gcc/config/darwin-c.c
index 0c713ba..08de2f8 100644
--- a/gcc/config/darwin-c.c
+++ b/gcc/config/darwin-c.c
@@ -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;
diff --git a/gcc/config/darwin-protos.h b/gcc/config/darwin-protos.h
index 4a99611..150230d 100644
--- a/gcc/config/darwin-protos.h
+++ b/gcc/config/darwin-protos.h
@@ -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);
diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h
index 2f5b638..4725015 100644
--- a/gcc/config/darwin.h
+++ b/gcc/config/darwin.h
@@ -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
index 0000000..7ca3d87
--- /dev/null
+++ b/gcc/config/default-c.c
@@ -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;
diff --git a/gcc/config/t-darwin b/gcc/config/t-darwin
index ff60787..1faafbe 100644
--- a/gcc/config/t-darwin
+++ b/gcc/config/t-darwin
@@ -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)