===================================================================
@@ -26,6 +26,10 @@ see the files COPYING3 and COPYING.RUNTI
#ifndef _STDNORETURN_H
#define _STDNORETURN_H
+#ifndef __cplusplus
+
#define noreturn _Noreturn
+#endif
+
#endif /* stdnoreturn.h */
===================================================================
@@ -0,0 +1,5 @@
+/* Test _Noreturn not in C99. */
+/* { dg-do compile } */
+/* { dg-options "-std=iso9899:1999 -pedantic-errors" } */
+
+_Noreturn void f (void); /* { dg-error "ISO C99 does not support '_Noreturn'" } */
===================================================================
@@ -0,0 +1,5 @@
+/* Test _Noreturn not in C90. */
+/* { dg-do compile } */
+/* { dg-options "-std=iso9899:1990 -pedantic-errors" } */
+
+_Noreturn void f (void); /* { dg-error "ISO C90 does not support '_Noreturn'" } */
===================================================================
@@ -5986,7 +5986,18 @@ grokdeclarator (const struct c_declarato
/* Record that the function is declared `inline'. */
DECL_DECLARED_INLINE_P (decl) = 1;
if (declspecs->noreturn_p)
- TREE_THIS_VOLATILE (decl) = 1;
+ {
+ if (!flag_isoc1x)
+ {
+ if (flag_isoc99)
+ pedwarn (loc, OPT_pedantic,
+ "ISO C99 does not support %<_Noreturn%>");
+ else
+ pedwarn (loc, OPT_pedantic,
+ "ISO C90 does not support %<_Noreturn%>");
+ }
+ TREE_THIS_VOLATILE (decl) = 1;
+ }
}
}
else
===================================================================
@@ -1905,6 +1905,9 @@ c_parser_static_assert_declaration_no_se
C99 6.7.4:
function-specifier:
inline
+ _Noreturn
+
+ (_Noreturn is new in C1X.)
C90 6.5.2, C99 6.7.2:
type-specifier: