aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-family
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/c-family
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/c-family')
-rw-r--r--gcc/c-family/ChangeLog12
-rw-r--r--gcc/c-family/c-common.c4
-rw-r--r--gcc/c-family/c-common.h1
-rw-r--r--gcc/c-family/c-format.c4
-rw-r--r--gcc/c-family/c-opts.c17
-rw-r--r--gcc/c-family/c-target-def.h22
-rw-r--r--gcc/c-family/c-target.def79
-rw-r--r--gcc/c-family/c-target.h37
8 files changed, 169 insertions, 7 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index 0250435..a7efe84 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -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
diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
index cab9e7e..1252b18 100644
--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -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. */
diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h
index 6046d3e..91e21ff 100644
--- a/gcc/c-family/c-common.h
+++ b/gcc/c-family/c-common.h
@@ -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,
diff --git a/gcc/c-family/c-format.c b/gcc/c-family/c-format.c
index 85831eb..801e434 100644
--- a/gcc/c-family/c-format.c
+++ b/gcc/c-family/c-format.c
@@ -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"
/* Set format warning options according to a -Wformat=n option. */
diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c
index 8d6e6e7..dd87591 100644
--- a/gcc/c-family/c-opts.c
+++ b/gcc/c-family/c-opts.c
@@ -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
index 0000000..00bdc25
--- /dev/null
+++ b/gcc/c-family/c-target-def.h
@@ -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
index 0000000..356fe26
--- /dev/null
+++ b/gcc/c-family/c-target.def
@@ -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
index 0000000..69ca4dd
--- /dev/null
+++ b/gcc/c-family/c-target.h
@@ -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 */