aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2013-04-07 13:15:22 -0400
committerJason Merrill <jason@gcc.gnu.org>2013-04-07 13:15:22 -0400
commit91392840bfb496e9142f39bb63d3f0df082c776c (patch)
treebe3da499344f61935abec508b48db064696c3c16
parentf2e2de5f851555162cbfa88fdcd10b785e348b10 (diff)
downloadgcc-91392840bfb496e9142f39bb63d3f0df082c776c.zip
gcc-91392840bfb496e9142f39bb63d3f0df082c776c.tar.gz
gcc-91392840bfb496e9142f39bb63d3f0df082c776c.tar.bz2
parser.c (cp_parser_std_attribute): Treat [[noreturn]] like GNU noreturn attribute.
* parser.c (cp_parser_std_attribute): Treat [[noreturn]] like GNU noreturn attribute. From-SVN: r197555
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/parser.c9
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/gen-attrs-4.C10
3 files changed, 17 insertions, 7 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index dc67610..1af1fd7 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2013-04-06 Jason Merrill <jason@redhat.com>
+
+ * parser.c (cp_parser_std_attribute): Treat [[noreturn]] like GNU
+ noreturn attribute.
+
2013-04-05 Ed Smith-Rowland <3dw4rd@verizon.net>
* parser.c (cp_parser_ref_qualifier_seq_opt): Move to
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index ed8eac8..856dc9a 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -20908,8 +20908,13 @@ cp_parser_std_attribute (cp_parser *parser)
token = cp_lexer_peek_token (parser->lexer);
}
else
- attribute = build_tree_list (build_tree_list (NULL_TREE, attr_id),
- NULL_TREE);
+ {
+ attribute = build_tree_list (build_tree_list (NULL_TREE, attr_id),
+ NULL_TREE);
+ /* C++11 noreturn attribute is equivalent to GNU's. */
+ if (is_attribute_p ("noreturn", attr_id))
+ TREE_PURPOSE (TREE_PURPOSE (attribute)) = get_identifier ("gnu");
+ }
/* Now parse the optional argument clause of the attribute. */
diff --git a/gcc/testsuite/g++.dg/cpp0x/gen-attrs-4.C b/gcc/testsuite/g++.dg/cpp0x/gen-attrs-4.C
index bad33d6..dff46b4 100644
--- a/gcc/testsuite/g++.dg/cpp0x/gen-attrs-4.C
+++ b/gcc/testsuite/g++.dg/cpp0x/gen-attrs-4.C
@@ -3,17 +3,17 @@
// Test for syntax support of various attribute permutations.
int
-[[gnu::noreturn]] // { dg-warning "ignored" }
+[[noreturn]] // { dg-warning "ignored" }
one
[[gnu::unused]]
(void);
-int one_third [[gnu::noreturn]] [[gnu::unused]] (void);
+int one_third [[noreturn]] [[gnu::unused]] (void);
int [[gnu::unused]] one_half(); // { dg-warning "ignored" }
static
-[[gnu::noreturn]] // { dg-warning "ignored" }
+[[noreturn]] // { dg-warning "ignored" }
void two [[gnu::unused]] (void) {}
@@ -21,10 +21,10 @@ void two [[gnu::unused]] (void) {}
[[gnu::unused]]
int
five(void)
-[[gnu::noreturn]] // { dg-warning "ignored" }
+[[noreturn]] // { dg-warning "ignored" }
{}
-[[gnu::noreturn]]
+[[noreturn]]
void
six (void)
;