# HG changeset patch # User Paul Eggert # Date 1310457774 25200 # Node ID d4809f2a119d1233298aeb95fa04f91d4903b7db # Parent 69de4b27fa313a00a8a8c0e6d8e503488e27a675 stdlib: use _Noreturn * lib/stdlib.in.h (_GL_ATTRIBUTE_NORETURN): Remove. (_Exit): Use _Noreturn rather than _GL_ATTRIBUTE_NORETURN. * modules/stdlib (Depends-on): Add _Noreturn. (stdlib.h): Depend on $(_NORETURN_H), and copy it in. diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2011-07-12 Paul Eggert + stdlib: use _Noreturn + * lib/stdlib.in.h (_GL_ATTRIBUTE_NORETURN): Remove. + (_Exit): Use _Noreturn rather than _GL_ATTRIBUTE_NORETURN. + * modules/stdlib (Depends-on): Add _Noreturn. + (stdlib.h): Depend on $(_NORETURN_H), and copy it in. + stdnoreturn-tests: new module * modules/stdnoreturn-tests, tests/test-stdnoreturn.c: New files. diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h --- a/lib/stdlib.in.h +++ b/lib/stdlib.in.h @@ -89,11 +89,7 @@ # include #endif -#if 3 <= __GNUC__ || __GNUC__ == 2 && 8 <= __GNUC_MINOR__ -# define _GL_ATTRIBUTE_NORETURN __attribute__ ((__noreturn__)) -#else -# define _GL_ATTRIBUTE_NORETURN -#endif +/* The definition of _Noreturn is copied here. */ /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */ @@ -120,7 +116,7 @@ /* Terminate the current process with the given return code, without running the 'atexit' handlers. */ # if !@HAVE__EXIT@ -_GL_FUNCDECL_SYS (_Exit, void, (int status) _GL_ATTRIBUTE_NORETURN); +_GL_FUNCDECL_SYS (_Exit, _Noreturn void, (int status)); # endif _GL_CXXALIAS_SYS (_Exit, void, (int status)); _GL_CXXALIASWARN (_Exit); diff --git a/modules/stdlib b/modules/stdlib --- a/modules/stdlib +++ b/modules/stdlib @@ -6,6 +6,7 @@ m4/stdlib_h.m4 Depends-on: +_Noreturn arg-nonnull c++defs include_next @@ -21,7 +22,8 @@ # We need the following in order to create when the system # doesn't have one that works with the given compiler. -stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) +stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) \ + $(_NORETURN_H) $(ARG_NONNULL_H) $(WARN_ON_USE_H) $(AM_V_GEN)rm -f $@-t $@ && \ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ sed -e 's|@''GUARD_PREFIX''@|${gl_include_guard_prefix}|g' \ @@ -95,6 +97,7 @@ -e 's|@''REPLACE_UNSETENV''@|$(REPLACE_UNSETENV)|g' \ -e 's|@''REPLACE_WCTOMB''@|$(REPLACE_WCTOMB)|g' \ -e '/definitions of _GL_FUNCDECL_RPL/r $(CXXDEFS_H)' \ + -e '/definition of _Noreturn/r $(_NORETURN_H)' \ -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)'; \ } > $@-t && \