From 4b69a607a11db64d663d264aa53292b2314f7152 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 12 Jul 2011 01:16:08 -0700 Subject: [PATCH] stdnoreturn, stdnoreturn-tests: remove modules They're not needed here and a bit premature for use elsewhere. See . * m4/stdnoreturn.m4, modules/stdnoreturn, modules/stdnoreturn-tests: * tests/test-stdnoreturn.c: Remove files. * MODULES.html.sh (_Noreturn ): Remove section. * lib/openat.h, lib/sigpipe-die.h, lib/xalloc.h, lib/xmemdup0.h: * lib/xstrtol.h: Use _Noreturn rather than including and using noreturn. * modules/openat, modules/sigpipe-die, modules/xalloc: * modules/xmemdup0, modules/xstrtol: Remove dependency on stdnoreturn. --- ChangeLog | 13 +++++++++++++ MODULES.html.sh | 10 ---------- lib/openat.h | 5 ++--- lib/sigpipe-die.h | 4 +--- lib/xalloc.h | 3 +-- lib/xmemdup0.h | 3 +-- lib/xstrtol.h | 7 +++---- m4/stdnoreturn.m4 | 22 ---------------------- modules/openat | 1 - modules/sigpipe-die | 1 - modules/stdnoreturn | 34 ---------------------------------- modules/stdnoreturn-tests | 10 ---------- modules/xalloc | 1 - modules/xmemdup0 | 1 - modules/xstrtol | 1 - tests/test-stdnoreturn.c | 47 ----------------------------------------------- 16 files changed, 21 insertions(+), 142 deletions(-) delete mode 100644 m4/stdnoreturn.m4 delete mode 100644 modules/stdnoreturn delete mode 100644 modules/stdnoreturn-tests delete mode 100644 tests/test-stdnoreturn.c diff --git a/ChangeLog b/ChangeLog index 28973716c..551943d3f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,18 @@ 2011-07-12 Paul Eggert + stdnoreturn, stdnoreturn-tests: remove modules + They're not needed here and a bit premature for use elsewhere. See + . + * m4/stdnoreturn.m4, modules/stdnoreturn, modules/stdnoreturn-tests: + * tests/test-stdnoreturn.c: Remove files. + * MODULES.html.sh (_Noreturn ): Remove section. + * lib/openat.h, lib/sigpipe-die.h, lib/xalloc.h, lib/xmemdup0.h: + * lib/xstrtol.h: Use _Noreturn rather than including + and using noreturn. + * modules/openat, modules/sigpipe-die, modules/xalloc: + * modules/xmemdup0, modules/xstrtol: + Remove dependency on stdnoreturn. + _Noreturn: Ignore __STDC_VERSION__; observe _MSC_VER. * build-aux/_Noreturn.h (_Noreturn): Ignore __STDC_VERSION__. Reparenthesize to avoid GCC warning. diff --git a/MODULES.html.sh b/MODULES.html.sh index 5a2e22b6d..464f1d892 100755 --- a/MODULES.html.sh +++ b/MODULES.html.sh @@ -2321,16 +2321,6 @@ func_all_modules () func_module _Noreturn func_end_table - element="_Noreturn " - element=`printf "%s" "$element" | sed -e "$sed_lt" -e "$sed_gt"` - func_section_wrap c1x_sup_stdnoreturn - func_wrap H3 - func_echo "$element" - - func_begin_table - func_module stdnoreturn - func_end_table - element="Support for obsolete systems lacking POSIX:2008" func_section_wrap posix_sup_obsolete func_wrap H2 diff --git a/lib/openat.h b/lib/openat.h index d1e74331f..b26571f82 100644 --- a/lib/openat.h +++ b/lib/openat.h @@ -26,7 +26,6 @@ #include #include #include -#include #if !HAVE_OPENAT @@ -42,8 +41,8 @@ bool openat_needs_fchdir (void); #endif -noreturn void openat_restore_fail (int); -noreturn void openat_save_fail (int); +_Noreturn void openat_restore_fail (int); +_Noreturn void openat_save_fail (int); /* Using these function names makes application code slightly more readable than it would be with diff --git a/lib/sigpipe-die.h b/lib/sigpipe-die.h index c103099cd..2e1ac27d7 100644 --- a/lib/sigpipe-die.h +++ b/lib/sigpipe-die.h @@ -41,8 +41,6 @@ #ifndef _SIGPIPE_DIE_H #define _SIGPIPE_DIE_H -#include - #ifdef __cplusplus extern "C" { #endif @@ -50,7 +48,7 @@ extern "C" { /* Emit an error message indicating a SIGPIPE signal, and terminate the process with an error code. */ -extern noreturn void sigpipe_die (void); +extern _Noreturn void sigpipe_die (void); /* Install a SIGPIPE handler that invokes PREPARE_DIE and then emits an error message and exits. PREPARE_DIE may be NULL, meaning a no-op. */ diff --git a/lib/xalloc.h b/lib/xalloc.h index 7dbcc79bb..b792aeffd 100644 --- a/lib/xalloc.h +++ b/lib/xalloc.h @@ -19,7 +19,6 @@ # define XALLOC_H_ # include -# include # include "xalloc-oversized.h" @@ -45,7 +44,7 @@ extern "C" { or by using gnulib's xalloc-die module. This is the function to call when one wants the program to die because of a memory allocation failure. */ -extern noreturn void xalloc_die (void); +extern _Noreturn void xalloc_die (void); void *xmalloc (size_t s) _GL_ATTRIBUTE_MALLOC _GL_ATTRIBUTE_ALLOC_SIZE ((1)); diff --git a/lib/xmemdup0.h b/lib/xmemdup0.h index fe083b7bd..fa1b2f057 100644 --- a/lib/xmemdup0.h +++ b/lib/xmemdup0.h @@ -19,7 +19,6 @@ # define XMEMDUP_H_ # include -# include # ifdef __cplusplus @@ -31,7 +30,7 @@ extern "C" { or by using gnulib's xalloc-die module. This is the function to call when one wants the program to die because of a memory allocation failure. */ -extern noreturn void xalloc_die (void); +extern _Noreturn void xalloc_die (void); char *xmemdup0 (void const *p, size_t s); diff --git a/lib/xstrtol.h b/lib/xstrtol.h index 171c3efbe..ad134ab8b 100644 --- a/lib/xstrtol.h +++ b/lib/xstrtol.h @@ -21,7 +21,6 @@ # include # include -# include # ifndef _STRTOL_ERROR enum strtol_error @@ -67,8 +66,8 @@ _DECLARE_XSTRTOL (xstrtoull, unsigned long long int) After reporting an error, exit with a failure status. */ -void noreturn xstrtol_fatal (enum strtol_error, - int, char, struct option const *, - char const *); +void _Noreturn xstrtol_fatal (enum strtol_error, + int, char, struct option const *, + char const *); #endif /* not XSTRTOL_H_ */ diff --git a/m4/stdnoreturn.m4 b/m4/stdnoreturn.m4 deleted file mode 100644 index 1a4406936..000000000 --- a/m4/stdnoreturn.m4 +++ /dev/null @@ -1,22 +0,0 @@ -# Check for stdnoreturn.h. - -dnl Copyright 2011 Free Software Foundation, Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -AC_DEFUN([gl_STDNORETURN_H], -[ - dnl Assume that a system-supplied stdnoreturn.h works if it exists. - AC_CHECK_HEADERS_ONCE([stdnoreturn.h]) - - if test "$ac_cv_header_stdnoreturn_h" = yes; then - STDNORETURN_H='' - else - STDNORETURN_H='stdnoreturn.h' - fi - AC_SUBST([STDNORETURN_H]) - - AM_CONDITIONAL([GL_GENERATE_STDNORETURN_H], - [test $ac_cv_header_stdnoreturn_h != yes]) -]) diff --git a/modules/openat b/modules/openat index 06a4c75aa..b9ce4d46a 100644 --- a/modules/openat +++ b/modules/openat @@ -32,7 +32,6 @@ openat-die rmdir [test $REPLACE_UNLINKAT = 1] save-cwd stdbool -stdnoreturn sys_stat unistd unlink [test $REPLACE_UNLINKAT = 1] diff --git a/modules/sigpipe-die b/modules/sigpipe-die index 90b477a9e..722966568 100644 --- a/modules/sigpipe-die +++ b/modules/sigpipe-die @@ -12,7 +12,6 @@ exitfail sigpipe sigprocmask sigaction -stdnoreturn configure.ac: diff --git a/modules/stdnoreturn b/modules/stdnoreturn deleted file mode 100644 index 1778862f5..000000000 --- a/modules/stdnoreturn +++ /dev/null @@ -1,34 +0,0 @@ -Description: -A that conforms to C1X. - -Files: -m4/stdnoreturn.m4 - -Depends-on: -_Noreturn - -configure.ac: -gl_STDNORETURN_H - -Makefile.am: -BUILT_SOURCES += $(STDNORETURN_H) - -# Create when the system doesn't have one that works. -if GL_GENERATE_STDNORETURN_H -stdnoreturn.h: $(top_builddir)/config.status $(_NORETURN_H) - { cat $(_NORETURN_H) && echo '#define noreturn _Noreturn'; } > $@-t - mv $@-t $@ -else -stdnoreturn.h: $(top_builddir)/config.status - rm -f $@ -endif -MOSTLYCLEANFILES += stdnoreturn.h - -Include: - - -License: -LGPLv2+ - -Maintainer: -all diff --git a/modules/stdnoreturn-tests b/modules/stdnoreturn-tests deleted file mode 100644 index 1d1f82003..000000000 --- a/modules/stdnoreturn-tests +++ /dev/null @@ -1,10 +0,0 @@ -Files: -tests/test-stdnoreturn.c - -Depends-on: - -configure.ac: - -Makefile.am: -TESTS += test-stdnoreturn -check_PROGRAMS += test-stdnoreturn diff --git a/modules/xalloc b/modules/xalloc index e96d0574c..19e7a0b93 100644 --- a/modules/xalloc +++ b/modules/xalloc @@ -8,7 +8,6 @@ m4/xalloc.m4 Depends-on: inline -stdnoreturn xalloc-die xalloc-oversized diff --git a/modules/xmemdup0 b/modules/xmemdup0 index aa60a82f3..d7ea438d7 100644 --- a/modules/xmemdup0 +++ b/modules/xmemdup0 @@ -6,7 +6,6 @@ lib/xmemdup0.h lib/xmemdup0.c Depends-on: -stdnoreturn xalloc configure.ac: diff --git a/modules/xstrtol b/modules/xstrtol index b7c79f156..66e53427e 100644 --- a/modules/xstrtol +++ b/modules/xstrtol @@ -15,7 +15,6 @@ getopt-gnu gettext-h intprops inttypes-incomplete -stdnoreturn configure.ac: gl_XSTRTOL diff --git a/tests/test-stdnoreturn.c b/tests/test-stdnoreturn.c deleted file mode 100644 index fed5e54b3..000000000 --- a/tests/test-stdnoreturn.c +++ /dev/null @@ -1,47 +0,0 @@ -/* Test of and _Noreturn. - Copyright 2011 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . */ - -/* written by Paul Eggert */ - -#include - -#include - -/* But did he ever return? No he never returned, - And his fate is still unlearned ... */ -static noreturn void MTA (void); - -static _Noreturn void -Charlie (void) -{ - MTA (); -} - -static void -MTA (void) -{ - Charlie (); -} - -int -main (int argc, char **argv) -{ - if (argc <= 0) - MTA (); - if (!argv[0][0]) - Charlie (); - return 0; -} -- 2.11.0