parser.c (cp_parser_std_attribute): Treat [[noreturn]] like GNU noreturn attribute.
authorJason Merrill <jason@redhat.com>
Sun, 7 Apr 2013 17:15:22 +0000 (13:15 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Sun, 7 Apr 2013 17:15:22 +0000 (13:15 -0400)
* parser.c (cp_parser_std_attribute): Treat [[noreturn]] like GNU
noreturn attribute.

From-SVN: r197555

gcc/cp/ChangeLog
gcc/cp/parser.c
gcc/testsuite/g++.dg/cpp0x/gen-attrs-4.C

index dc6761033028c3314a714a6b55814231ef43aa60..1af1fd7467bc9475163ba0e9d80c73a503412086 100644 (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
index ed8eac8cc4e007a57349ac3443c340c33065877f..856dc9a85e3ee6dbea56b285f44f6adabdb5611a 100644 (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.  */
 
index bad33d6e822e1e5a988f932f7e1ca9906453ae60..dff46b4af76d8a9a29e82190d22d1b7cea790ad7 100644 (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)
 ;