summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2010-05-05 15:33:11 -0400
committerJason Merrill <jason@gcc.gnu.org>2010-05-05 15:33:11 -0400
commit564a129d2270cd6cd14683013483b1471f0d04f1 (patch)
tree2f0d1539c4a77f271f5a52bc32ed5f1726956909
parent58c13acc6abf49f392d72d269e6c0a88eae25319 (diff)
re PR testsuite/43758 (19 new GCC HEAD@158360 regressions)
PR testsuite/43758 * target.h (struct gcc_target): Add attribute_takes_identifier_p. * target_def.h (TARGET_ATTRIBUTE_TAKES_IDENTIFIER_P): Define. (TARGET_INITIALIZER): Use it. * c-common.c (attribute_takes_identifier_p): Call it. * c-common.h: Update prototype. * config/rs6000/rs6000.c (rs6000_attribute_takes_identifier_p): New. (TARGET_ATTRIBUTE_TAKES_IDENTIFIER_P): Define. From-SVN: r159079
-rw-r--r--gcc/ChangeLog11
-rw-r--r--gcc/c-common.c11
-rw-r--r--gcc/c-common.h2
-rw-r--r--gcc/config/rs6000/rs6000.c12
-rw-r--r--gcc/doc/tm.texi8
-rw-r--r--gcc/target-def.h2
-rw-r--r--gcc/target.h4
7 files changed, 45 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index e6c95de72de..4c9263d793c 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,14 @@
+2010-05-05 Jason Merrill <jason@redhat.com>
+
+ PR testsuite/43758
+ * target.h (struct gcc_target): Add attribute_takes_identifier_p.
+ * target_def.h (TARGET_ATTRIBUTE_TAKES_IDENTIFIER_P): Define.
+ (TARGET_INITIALIZER): Use it.
+ * c-common.c (attribute_takes_identifier_p): Call it.
+ * c-common.h: Update prototype.
+ * config/rs6000/rs6000.c (rs6000_attribute_takes_identifier_p): New.
+ (TARGET_ATTRIBUTE_TAKES_IDENTIFIER_P): Define.
+
2010-05-05 Jakub Jelinek <jakub@redhat.com>
PR debug/43950
diff --git a/gcc/c-common.c b/gcc/c-common.c
index 17183448d40..6fa577c293a 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -5816,11 +5816,14 @@ c_init_attributes (void)
identifier as an argument, so the front end shouldn't look it up. */
bool
-attribute_takes_identifier_p (tree attr_id)
+attribute_takes_identifier_p (const_tree attr_id)
{
- return (is_attribute_p ("mode", attr_id)
- || is_attribute_p ("format", attr_id)
- || is_attribute_p ("cleanup", attr_id));
+ if (is_attribute_p ("mode", attr_id)
+ || is_attribute_p ("format", attr_id)
+ || is_attribute_p ("cleanup", attr_id))
+ return true;
+ else
+ return targetm.attribute_takes_identifier_p (attr_id);
}
/* Attribute handlers common to C front ends. */
diff --git a/gcc/c-common.h b/gcc/c-common.h
index e79a3929087..7f47c2e457b 100644
--- a/gcc/c-common.h
+++ b/gcc/c-common.h
@@ -826,7 +826,7 @@ extern void check_function_format (tree, int, tree *);
extern void set_Wformat (int);
extern tree handle_format_attribute (tree *, tree, tree, int, bool *);
extern tree handle_format_arg_attribute (tree *, tree, tree, int, bool *);
-extern bool attribute_takes_identifier_p (tree);
+extern bool attribute_takes_identifier_p (const_tree);
extern int c_common_handle_option (size_t code, const char *arg, int value);
extern bool c_common_missing_argument (const char *opt, size_t code);
extern tree c_common_type_for_mode (enum machine_mode, int);
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 1360bf4aef9..d1616e523fb 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -897,6 +897,7 @@ static bool no_global_regs_above (int, bool);
static void rs6000_assemble_visibility (tree, int);
#endif
static int rs6000_ra_ever_killed (void);
+static bool rs6000_attribute_takes_identifier_p (const_tree);
static tree rs6000_handle_longcall_attribute (tree *, tree, tree, int, bool *);
static tree rs6000_handle_altivec_attribute (tree *, tree, tree, int, bool *);
static bool rs6000_ms_bitfield_layout_p (const_tree);
@@ -1279,6 +1280,8 @@ static const struct attribute_spec rs6000_attribute_table[] =
#define TARGET_ATTRIBUTE_TABLE rs6000_attribute_table
#undef TARGET_SET_DEFAULT_TYPE_ATTRIBUTES
#define TARGET_SET_DEFAULT_TYPE_ATTRIBUTES rs6000_set_default_type_attributes
+#undef TARGET_ATTRIBUTE_TAKES_IDENTIFIER_P
+#define TARGET_ATTRIBUTE_TAKES_IDENTIFIER_P rs6000_attribute_takes_identifier_p
#undef TARGET_ASM_ALIGNED_DI_OP
#define TARGET_ASM_ALIGNED_DI_OP DOUBLE_INT_ASM_OP
@@ -23320,6 +23323,15 @@ rs6000_trampoline_init (rtx m_tramp, tree fndecl, rtx cxt)
}
+/* Returns TRUE iff the target attribute indicated by ATTR_ID takes a plain
+ identifier as an argument, so the front end shouldn't look it up. */
+
+static bool
+rs6000_attribute_takes_identifier_p (const_tree attr_id)
+{
+ return is_attribute_p ("altivec", attr_id);
+}
+
/* Handle the "altivec" attribute. The attribute may have
arguments as follows:
diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi
index 3a36314d00f..7eb49d63539 100644
--- a/gcc/doc/tm.texi
+++ b/gcc/doc/tm.texi
@@ -9525,6 +9525,14 @@ entities to which these attributes are applied and the arguments they
take.
@end deftypevr
+@deftypefn {Target Hook} bool TARGET_ATTRIBUTE_TAKES_IDENTIFIER_P (const_tree @var{name})
+If defined, this target hook is a function which returns true if the
+machine-specific attribute named @var{name} expects an identifier
+given as its first argument to be passed on as a plain identifier, not
+subjected to name lookup. If this is not defined, the default is
+false for all machine-specific attributes.
+@end deftypefn
+
@deftypefn {Target Hook} int TARGET_COMP_TYPE_ATTRIBUTES (const_tree @var{type1}, const_tree @var{type2})
If defined, this target hook is a function which returns zero if the attributes on
@var{type1} and @var{type2} are incompatible, one if they are compatible,
diff --git a/gcc/target-def.h b/gcc/target-def.h
index 1c734369c23..1f60e52f30d 100644
--- a/gcc/target-def.h
+++ b/gcc/target-def.h
@@ -561,6 +561,7 @@
#define TARGET_MAX_ANCHOR_OFFSET 0
#define TARGET_USE_ANCHORS_FOR_SYMBOL_P default_use_anchors_for_symbol_p
#define TARGET_FUNCTION_OK_FOR_SIBCALL hook_bool_tree_tree_false
+#define TARGET_ATTRIBUTE_TAKES_IDENTIFIER_P hook_bool_const_tree_false
#define TARGET_COMP_TYPE_ATTRIBUTES hook_int_const_tree_const_tree_1
#ifndef TARGET_SET_DEFAULT_TYPE_ATTRIBUTES
#define TARGET_SET_DEFAULT_TYPE_ATTRIBUTES hook_void_tree
@@ -932,6 +933,7 @@
TARGET_MERGE_DECL_ATTRIBUTES, \
TARGET_MERGE_TYPE_ATTRIBUTES, \
TARGET_ATTRIBUTE_TABLE, \
+ TARGET_ATTRIBUTE_TAKES_IDENTIFIER_P, \
TARGET_COMP_TYPE_ATTRIBUTES, \
TARGET_SET_DEFAULT_TYPE_ATTRIBUTES, \
TARGET_INSERT_ATTRIBUTES, \
diff --git a/gcc/target.h b/gcc/target.h
index 6ff7d1d639e..2f99a4f8bb4 100644
--- a/gcc/target.h
+++ b/gcc/target.h
@@ -549,6 +549,10 @@ struct gcc_target
Ignored if NULL. */
const struct attribute_spec *attribute_table;
+ /* Return true iff attribute NAME expects a plain identifier as its first
+ argument. */
+ bool (*attribute_takes_identifier_p) (const_tree name);
+
/* Return zero if the attributes on TYPE1 and TYPE2 are incompatible,
one if they are compatible and two if they are nearly compatible
(which causes a warning to be generated). */