OSDN Git Service

PR testsuite/43758
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 5 May 2010 19:33:11 +0000 (19:33 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 5 May 2010 19:33:11 +0000 (19:33 +0000)
* 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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159079 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/c-common.c
gcc/c-common.h
gcc/config/rs6000/rs6000.c
gcc/doc/tm.texi
gcc/target-def.h
gcc/target.h

index e6c95de..4c9263d 100644 (file)
@@ -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
index 1718344..6fa577c 100644 (file)
@@ -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.  */
index e79a392..7f47c2e 100644 (file)
@@ -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);
index 1360bf4..d1616e5 100644 (file)
@@ -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)
 }
 
 \f
+/* 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:
 
index 3a36314..7eb49d6 100644 (file)
@@ -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,
index 1c73436..1f60e52 100644 (file)
 #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
   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,                    \
index 6ff7d1d..2f99a4f 100644 (file)
@@ -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).  */