changeset 15396:d4809f2a119d

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.
author Paul Eggert <eggert@cs.ucla.edu>
date Tue, 12 Jul 2011 01:02:54 -0700
parents 69de4b27fa31
children 7d9ccb480220
files ChangeLog lib/stdlib.in.h modules/stdlib
diffstat 3 files changed, 12 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2011-07-12  Paul Eggert  <eggert@cs.ucla.edu>
 
+	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.
 
--- a/lib/stdlib.in.h
+++ b/lib/stdlib.in.h
@@ -89,11 +89,7 @@
 # include <unistd.h>
 #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);
--- 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 <stdlib.h> 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 && \