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
This commit is contained in:
Jason Merrill 2013-04-07 13:15:22 -04:00 committed by Jason Merrill
parent f2e2de5f85
commit 91392840bf
3 changed files with 17 additions and 7 deletions

View file

@ -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

View file

@ -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. */

View file

@ -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)
;