summaryrefslogtreecommitdiffstats
path: root/gcc/attribs.c
diff options
context:
space:
mode:
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2007-09-23 02:36:34 +0000
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2007-09-23 02:36:34 +0000
commit2fdd6488b59abc8f1da3d423d45044ffb82533cd (patch)
tree17a3573bc82b532229f930f45caf02beb84bdead /gcc/attribs.c
parent6d51dde5dd855acc798372dab5e072014888647e (diff)
downloadppe42-gcc-2fdd6488b59abc8f1da3d423d45044ffb82533cd.tar.gz
ppe42-gcc-2fdd6488b59abc8f1da3d423d45044ffb82533cd.zip
PR c++/19407
* cp/cp-tree.h (ATTR_IS_DEPENDENT): New macro. (MAYBE_TAGGED_TYPE_P): Remove. * cp/pt.c (apply_late_template_attributes): Check ATTR_IS_DEPENDENT instead of calling is_late_template_attribute again. (tsubst_decl) [TYPE_DECL]: Just check if the name is the tag. (tsubst): A typedef is a TYPE_NAME != TYPE_MAIN_DECL. Don't crash on typedefs from non-template classes. * cp/decl2.c (grokfield): Don't sorry about attrs on template parms. (is_late_template_attribute): All attributes applied to template parms or typename types are dependent. Static, take decl. (splice_template_attributes): Pass decl through. (save_template_attributes): Likewise. * attribs.c (lookup_attribute_spec): Split out... (decl_attributes): From here. * tree.h: Declare it. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@128681 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/attribs.c')
-rw-r--r--gcc/attribs.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/gcc/attribs.c b/gcc/attribs.c
index feb1c301570..31b92cad508 100644
--- a/gcc/attribs.c
+++ b/gcc/attribs.c
@@ -195,6 +195,20 @@ init_attributes (void)
}
attributes_initialized = true;
}
+
+/* Return the spec for the attribute named NAME. */
+
+const struct attribute_spec *
+lookup_attribute_spec (tree name)
+{
+ struct substring attr;
+
+ attr.str = IDENTIFIER_POINTER (name);
+ attr.length = IDENTIFIER_LENGTH (name);
+ extract_attribute_substring (&attr);
+ return htab_find_with_hash (attribute_hash, &attr,
+ substring_hash (attr.str, attr.length));
+}
/* Process the attributes listed in ATTRIBUTES and install them in *NODE,
which is either a DECL (including a TYPE_DECL) or a TYPE. If a DECL,
@@ -221,16 +235,9 @@ decl_attributes (tree *node, tree attributes, int flags)
tree name = TREE_PURPOSE (a);
tree args = TREE_VALUE (a);
tree *anode = node;
- const struct attribute_spec *spec = NULL;
+ const struct attribute_spec *spec = lookup_attribute_spec (name);
bool no_add_attrs = 0;
tree fn_ptr_tmp = NULL_TREE;
- struct substring attr;
-
- attr.str = IDENTIFIER_POINTER (name);
- attr.length = IDENTIFIER_LENGTH (name);
- extract_attribute_substring (&attr);
- spec = htab_find_with_hash (attribute_hash, &attr,
- substring_hash (attr.str, attr.length));
if (spec == NULL)
{
OpenPOWER on IntegriCloud