stdlib: use _Noreturn
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 12 Jul 2011 08:02:54 +0000 (01:02 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 12 Jul 2011 08:02:54 +0000 (01:02 -0700)
* 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
lib/stdlib.in.h
modules/stdlib

index 1ae8e86..56ad1dd 100644 (file)
--- 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.
 
index 62a2ce9..047fac1 100644 (file)
@@ -89,11 +89,7 @@ struct random_data
 # 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 @@ 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);
index 473b46a..0ec07fb 100644 (file)
@@ -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 <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 @@ 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 && \