From 91392840bfb496e9142f39bb63d3f0df082c776c Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Sun, 7 Apr 2013 13:15:22 -0400 Subject: [PATCH] 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 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/parser.c | 9 +++++++-- gcc/testsuite/g++.dg/cpp0x/gen-attrs-4.C | 10 +++++----- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index dc676103302..1af1fd7467b 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2013-04-06 Jason Merrill + + * 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 ed8eac8cc4e..856dc9a85e3 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 bad33d6e822..dff46b4af76 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) ; -- 2.30.2