pedantic.
* c-parser.c (c_parser_declspecs): Include _Noreturn in syntax
comment.
* ginclude/stdnoreturn.h (noreturn): Don't define for C++.
testsuite:
* gcc.dg/c90-noreturn-1.c, gcc.dg/c99-noreturn-1.c: New tests.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@177899
138bc75d-0d04-0410-961f-
82ee72b054a4
2011-08-19 Joseph Myers <joseph@codesourcery.com>
+ * c-decl.c (grokdeclarator): Diagnose _Noreturn for non-C1X if
+ pedantic.
+ * c-parser.c (c_parser_declspecs): Include _Noreturn in syntax
+ comment.
+ * ginclude/stdnoreturn.h (noreturn): Don't define for C++.
+
+2011-08-19 Joseph Myers <joseph@codesourcery.com>
+
* opth-gen.awk: Do not declare target save/restore structures and
functions if IN_RTS defined.
/* 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
C99 6.7.4:
function-specifier:
inline
+ _Noreturn
+
+ (_Noreturn is new in C1X.)
C90 6.5.2, C99 6.7.2:
type-specifier:
#ifndef _STDNORETURN_H
#define _STDNORETURN_H
+#ifndef __cplusplus
+
#define noreturn _Noreturn
+#endif
+
#endif /* stdnoreturn.h */
+2011-08-19 Joseph Myers <joseph@codesourcery.com>
+
+ * gcc.dg/c90-noreturn-1.c, gcc.dg/c99-noreturn-1.c: New tests.
+
2011-08-19 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* gcc.dg/builtins-67.c: Use dg-add-options c99_runtime.
--- /dev/null
+/* 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'" } */
--- /dev/null
+/* 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'" } */