summaryrefslogtreecommitdiff
path: root/gcc/attribs.c
diff options
context:
space:
mode:
authornicola <nicola@138bc75d-0d04-0410-961f-82ee72b054a4>2011-06-22 09:52:55 +0000
committernicola <nicola@138bc75d-0d04-0410-961f-82ee72b054a4>2011-06-22 09:52:55 +0000
commitc55c785fe9fbf6306e67e02ef3e4926c8dfa1d33 (patch)
treeeb06d313c03be1290b9c63500235d5b1ba88492d /gcc/attribs.c
parentdab5a23961dbc80a62b8fa622f93634b99e36f5c (diff)
downloadgcc-c55c785fe9fbf6306e67e02ef3e4926c8dfa1d33.tar.gz
In gcc/:
2011-06-21 Nicola Pero <nicola.pero@meta-innovation.com> * attribs.c (register_attribute): Added assert to check that all attribute specs are registered with a name that is not empty and does not start with '_'. (decl_attributes): Avoid the lookup of the "naked" attribute spec if the function has no attributes. * tree.c (is_attribute_with_length_p): Removed. (is_attribute_p): Removed. (private_is_attribute_p): New. (private_lookup_attribute): New. (lookup_attribute): Removed. (lookup_ident_attribute): New. (remove_attribute): Require the first argument to be in the form 'text', not '__text__'. Updated asserts. (merge_attributes): Use lookup_ident_attributes instead of lookup_attribute. (merge_dllimport_decl_attributes): Use remove_attribute. (attribute_list_contained): Likewise. (attribute_list_equal): Immediately return 1 if the arguments are identical pointers. * tree.h (is_attribute_p): Made inline. Return a 'bool', not an 'int'. Require the first argument to be in the form 'text', not '__text__'. Require the second argument to be an identifier. (lookup_attribute): Made inline. Require the first argument to be in the form 'text', not '__text__'. (private_is_attribute_p, private_lookup_attribute): New. Updated comments. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@175286 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/attribs.c')
-rw-r--r--gcc/attribs.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/attribs.c b/gcc/attribs.c
index ce977d4a337..98a6310294b 100644
--- a/gcc/attribs.c
+++ b/gcc/attribs.c
@@ -198,6 +198,11 @@ register_attribute (const struct attribute_spec *attr)
str.str = attr->name;
str.length = strlen (str.str);
+
+ /* Attribute names in the table must be in the form 'text' and not
+ in the form '__text__'. */
+ gcc_assert (str.length > 0 && str.str[0] != '_');
+
slot = htab_find_slot_with_hash (attribute_hash, &str,
substring_hash (str.str, str.length),
INSERT);
@@ -279,6 +284,7 @@ decl_attributes (tree *node, tree attributes, int flags)
/* A "naked" function attribute implies "noinline" and "noclone" for
those targets that support it. */
if (TREE_CODE (*node) == FUNCTION_DECL
+ && attributes
&& lookup_attribute_spec (get_identifier ("naked"))
&& lookup_attribute ("naked", attributes) != NULL)
{