aboutsummaryrefslogtreecommitdiff
path: root/gcc/attribs.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2012-11-09 11:14:37 -0500
committerJason Merrill <jason@gcc.gnu.org>2012-11-09 11:14:37 -0500
commit7dbb85a7932149aa5bac38fd77424b15c0248990 (patch)
treeaf7983d092e390f212209b62a57e8d2eac7d8be6 /gcc/attribs.c
parent52dccf7ac9926edabb9574d6440314938a33c143 (diff)
downloadgcc-7dbb85a7932149aa5bac38fd77424b15c0248990.zip
gcc-7dbb85a7932149aa5bac38fd77424b15c0248990.tar.gz
gcc-7dbb85a7932149aa5bac38fd77424b15c0248990.tar.bz2
Add C++ attribute abi_tag and -Wabi-tag option.
gcc/ * attribs.c (lookup_attribute_spec): Handle getting a TREE_LIST. gcc/c-family/ * c.opt (Wabi-tag): New. gcc/cp/ * tree.c (cxx_attribute_table): Add abi_tag attribute. (check_abi_tag_redeclaration, handle_abi_tag_attribute): New. * class.c (find_abi_tags_r, check_abi_tags): New. (check_bases, check_field_decl): Call check_abi_tags. * decl.c (redeclaration_error_message): Call check_abi_tag_redeclaration. * mangle.c (tree_string_cmp, write_abi_tags): New. (write_unqualified_name): Call write_abi_tags. include/ * demangle.h (enum demangle_component_type): Add DEMANGLE_COMPONENT_TAGGED_NAME. libiberty/ * cp-demangle.c (d_dump): Handle DEMANGLE_COMPONENT_TAGGED_NAME. (d_make_comp, d_find_pack, d_print_comp): Likewise. (d_abi_tags): New. (d_name): Call it. From-SVN: r193367
Diffstat (limited to 'gcc/attribs.c')
-rw-r--r--gcc/attribs.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/gcc/attribs.c b/gcc/attribs.c
index d167c1f..0425de9 100644
--- a/gcc/attribs.c
+++ b/gcc/attribs.c
@@ -325,12 +325,21 @@ lookup_scoped_attribute_spec (const_tree ns, const_tree name)
substring_hash (attr.str, attr.length));
}
-/* Return the spec for the attribute named NAME. */
+/* Return the spec for the attribute named NAME. If NAME is a TREE_LIST,
+ it also specifies the attribute namespace. */
const struct attribute_spec *
lookup_attribute_spec (const_tree name)
{
- return lookup_scoped_attribute_spec (get_identifier ("gnu"), name);
+ tree ns;
+ if (TREE_CODE (name) == TREE_LIST)
+ {
+ ns = TREE_PURPOSE (name);
+ name = TREE_VALUE (name);
+ }
+ else
+ ns = get_identifier ("gnu");
+ return lookup_scoped_attribute_spec (ns, name);
}