This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: C1X _Noreturn


On 08/18/2011 11:37 PM, Joseph S. Myers wrote:
C1X provides a standard way of declaring non-returning functions, with
the _Noreturn keyword and a header stdnoreturn.h defining a macro
"noreturn" to expand to _Noreturn.  This patch implements this syntax
and header.  Bootstrapped with no regressions on
x86_64-unknown-linux-gnu.  Applied to mainline.

I didn't touch the USER_H definition in mips/t-sdemtk (so that target
will not install this new header).  The comment "Remove stdarg.h and
stddef.h from USER_H." suggests that maybe it should be added to that
definition, but stdfix.h is also missing from that definition.  As far
as I know MIPS is no longer using the old SDE library and it is
considered superseded by newlib, so perhaps that configuration
(mips*-sde-elf* without newlib) should actually be deprecated/removed
(and "mipssde" threads along with it).

The new keyword is C-only (C++0x has a different way of declaring
non-returning functions) and I did not try to make the header do
anything useful if included in C++ code.

2011-08-18 Joseph Myers<joseph@codesourcery.com>

	* c-decl.c (shadow_tag_warned): Check for _Noreturn.
	(quals_from_declspecs): Assert _Noreturn not present.
	(grokdeclarator): Handle _Noreturn.
	(build_null_declspecs): Initialize noreturn_p.
	(declspecs_add_scspec): Handle RID_NORETURN.
	* c-parser.c (c_token_starts_declspecs, c_parser_declspecs)
	(c_parser_attributes): Handle RID_NORETURN.
	* c-tree.h (struct c_declspecs): Add noreturn_p.
	* ginclude/stdnoreturn.h: New.
	* Makefile.in (USER_H): Add stdnoreturn.h.

c-family:
2011-08-18  Joseph Myers<joseph@codesourcery.com>

	* c-common.c (c_common_reswords): Add _Noreturn.
	(keyword_is_function_specifier): Handle RID_NORETURN.
	* c-common.h (RID_NORETURN): New.

testsuite:
2011-08-18  Joseph Myers<joseph@codesourcery.com>

	* gcc.dg/c1x-noreturn-1.c, gcc.dg/c1x-noreturn-2.c,
	gcc.dg/c1x-noreturn-3.c, gcc.dg/c1x-noreturn-4.c,
	gcc.dg/c1x-noreturn-5.c: New tests.

Would it make any sense to accept _Noreturn as an alternative spelling for the __noreturn__ attribute, in case someone is using the non-underscore-wrapped variant?


Thanks,

Paolo


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]