aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2018-10-24 21:39:23 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2018-10-24 21:39:23 +0200
commitdf51934dcee2328fb6a257bdda7e177f8b2cc6a2 (patch)
tree91b13013e71b1e4391571125e25ce32e8a618ec7 /gcc
parenta703b16ba4c641e3e23f2630f9ae13d50fc9d7cf (diff)
downloadgcc-df51934dcee2328fb6a257bdda7e177f8b2cc6a2.zip
gcc-df51934dcee2328fb6a257bdda7e177f8b2cc6a2.tar.gz
gcc-df51934dcee2328fb6a257bdda7e177f8b2cc6a2.tar.bz2
re PR c++/86288 (Recognize __gnu and/or __gnu__ as attribute-namespace)
PR c++/86288 * parser.c (cp_parser_std_attribute): Canonicalize attr_ns, and when :: is not present and attr_ns non-NULL, canonicalize also attr_id. (cp_parser_attribute_spec): Fix comment typo. * g++.dg/cpp0x/gen-attrs-66.C: New test. From-SVN: r265470
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog7
-rw-r--r--gcc/cp/parser.c11
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/gen-attrs-66.C12
4 files changed, 32 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index fad8690..c90d91b 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,10 @@
+2018-10-24 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/86288
+ * parser.c (cp_parser_std_attribute): Canonicalize attr_ns, and when
+ :: is not present and attr_ns non-NULL, canonicalize also attr_id.
+ (cp_parser_attribute_spec): Fix comment typo.
+
2018-10-24 Martin Sebor <msebor@redhat.com>
PR c++/84851
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index c46b776..2533871 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -25327,14 +25327,19 @@ cp_parser_std_attribute (cp_parser *parser, tree attr_ns)
return error_mark_node;
}
+ attr_ns = canonicalize_attr_name (attr_ns);
attr_id = canonicalize_attr_name (attr_id);
attribute = build_tree_list (build_tree_list (attr_ns, attr_id),
NULL_TREE);
token = cp_lexer_peek_token (parser->lexer);
}
else if (attr_ns)
- attribute = build_tree_list (build_tree_list (attr_ns, attr_id),
- NULL_TREE);
+ {
+ attr_ns = canonicalize_attr_name (attr_ns);
+ attr_id = canonicalize_attr_name (attr_id);
+ attribute = build_tree_list (build_tree_list (attr_ns, attr_id),
+ NULL_TREE);
+ }
else
{
attr_id = canonicalize_attr_name (attr_id);
@@ -25526,7 +25531,7 @@ cp_parser_std_attribute_spec (cp_parser *parser)
|| !cp_parser_require (parser, CPP_CLOSE_SQUARE, RT_CLOSE_SQUARE))
cp_parser_skip_to_end_of_statement (parser);
else
- /* Warn about parsing c++11 attribute in non-c++1 mode, only
+ /* Warn about parsing c++11 attribute in non-c++11 mode, only
when we are sure that we have actually parsed them. */
maybe_warn_cpp0x (CPP0X_ATTRIBUTES);
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 6f9ba884..96ef4b9 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2018-10-24 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/86288
+ * g++.dg/cpp0x/gen-attrs-66.C: New test.
+
2018-10-24 Martin Sebor <msebor@redhat.com>
PR c++/84851
diff --git a/gcc/testsuite/g++.dg/cpp0x/gen-attrs-66.C b/gcc/testsuite/g++.dg/cpp0x/gen-attrs-66.C
new file mode 100644
index 0000000..de81dbb
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/gen-attrs-66.C
@@ -0,0 +1,12 @@
+// PR c++/86288
+// { dg-do compile { target c++11 } }
+// { dg-options "-Wattributes" }
+
+int a [[gnu::aligned(alignof(int))]];
+int b [[gnu::__aligned__(alignof(int))]];
+int c [[__gnu__::aligned(alignof(int))]];
+int d [[__gnu__::__aligned__(alignof(int))]];
+int e [[using gnu : aligned(alignof(int))]]; // { dg-warning "attribute using prefix only available" "" { target c++14_down } }
+int f [[using gnu : __aligned__(alignof(int))]]; // { dg-warning "attribute using prefix only available" "" { target c++14_down } }
+int g [[using __gnu__ : aligned(alignof(int))]]; // { dg-warning "attribute using prefix only available" "" { target c++14_down } }
+int h [[using __gnu__ : __aligned__(alignof(int))]]; // { dg-warning "attribute using prefix only available" "" { target c++14_down } }