From f67969b06caf232f8170ff3710e0247dbf62603a Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 12 Jul 2011 01:02:54 -0700 Subject: [PATCH] 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. --- ChangeLog | 6 ++++++ lib/stdlib.in.h | 8 ++------ modules/stdlib | 5 ++++- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1ae8e86b03..56ad1ddf90 100644 --- 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 index 62a2ce920e..047fac18b8 100644 --- a/lib/stdlib.in.h +++ b/lib/stdlib.in.h @@ -89,11 +89,7 @@ struct random_data # 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 @@ struct random_data /* 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 index 473b46a9de..0ec07fb557 100644 --- a/modules/stdlib +++ b/modules/stdlib @@ -6,6 +6,7 @@ lib/stdlib.in.h m4/stdlib_h.m4 Depends-on: +_Noreturn arg-nonnull c++defs include_next @@ -21,7 +22,8 @@ BUILT_SOURCES += stdlib.h # 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 @@ stdlib.h: stdlib.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H -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 && \ -- 2.30.2