bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 01/19] * m4/gnulib-common.m4 (gl_COMMON_BODY): Add _Noreturn.


From: Paul Eggert
Subject: Re: [PATCH 01/19] * m4/gnulib-common.m4 (gl_COMMON_BODY): Add _Noreturn.
Date: Mon, 11 Jul 2011 21:58:26 -0700
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.17) Gecko/20110516 Thunderbird/3.1.10

On 07/11/11 16:27, Bruno Haible wrote:

> I would prefer if these files could use '_Noreturn' as well, for consistency,
> and to avoid problems in mixed C / C++ packages (such as gettext and Octave).

On 07/11/11 17:49, Bruno Haible wrote:

> In the current state of the standards, every use of <stdnoreturn.h> is 
> invalid C++.

OK, thanks, for helping to think through this.  Since the stdnoreturn
module no longer seems useful, the following patch removes it as well.
If it later finds some use we can reinstate it.

stdnoreturn, stdnoreturn-tests: remove modules
They're not needed here and a bit premature for use elsewhere.  See
<http://lists.gnu.org/archive/html/bug-gnulib/2011-07/msg00209.html>.
* m4/stdnoreturn.m4, modules/stdnoreturn, modules/stdnoreturn-tests:
* tests/test-stdnoreturn.c: Remove files.
* MODULES.html.sh (_Noreturn <stdnoreturn.h>): Remove section.
* lib/openat.h, lib/sigpipe-die.h, lib/xalloc.h, lib/xmemdup0.h:
* lib/xstrtol.h: Use _Noreturn rather than including <stdnoreturn.h>
and using noreturn.
* modules/openat, modules/sigpipe-die, modules/xalloc:
* modules/xmemdup0, modules/xstrtol:
Remove dependency on stdnoreturn.
diff --git a/MODULES.html.sh b/MODULES.html.sh
index 2eb9b50..3f975ca 100755
--- a/MODULES.html.sh
+++ b/MODULES.html.sh
@@ -2320,16 +2320,6 @@ func_all_modules ()
   func_module _Noreturn
   func_end_table

-  element="_Noreturn <stdnoreturn.h>"
-  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 d1e7433..b26571f 100644
--- a/lib/openat.h
+++ b/lib/openat.h
@@ -26,7 +26,6 @@
 #include <dirent.h>
 #include <unistd.h>
 #include <stdbool.h>
-#include <stdnoreturn.h>

 #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 c103099..2e1ac27 100644
--- a/lib/sigpipe-die.h
+++ b/lib/sigpipe-die.h
@@ -41,8 +41,6 @@
 #ifndef _SIGPIPE_DIE_H
 #define _SIGPIPE_DIE_H

-#include <stdnoreturn.h>
-
 #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 7dbcc79..b792aef 100644
--- a/lib/xalloc.h
+++ b/lib/xalloc.h
@@ -19,7 +19,6 @@
 # define XALLOC_H_

 # include <stddef.h>
-# include <stdnoreturn.h>

 # 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 fe083b7..fa1b2f0 100644
--- a/lib/xmemdup0.h
+++ b/lib/xmemdup0.h
@@ -19,7 +19,6 @@
 # define XMEMDUP_H_

 # include <stddef.h>
-# include <stdnoreturn.h>


 # 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 171c3ef..ad134ab 100644
--- a/lib/xstrtol.h
+++ b/lib/xstrtol.h
@@ -21,7 +21,6 @@

 # include <getopt.h>
 # include <inttypes.h>
-# include <stdnoreturn.h>

 # 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 1a44069..0000000
--- 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 06a4c75..b9ce4d4 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 90b477a..7229665 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 1778862..0000000
--- a/modules/stdnoreturn
+++ /dev/null
@@ -1,34 +0,0 @@
-Description:
-A <stdnoreturn.h> that conforms to C1X.
-
-Files:
-m4/stdnoreturn.m4
-
-Depends-on:
-_Noreturn
-
-configure.ac:
-gl_STDNORETURN_H
-
-Makefile.am:
-BUILT_SOURCES += $(STDNORETURN_H)
-
-# Create <stdnoreturn.h> 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'; } > 
address@hidden
-       mv address@hidden $@
-else
-stdnoreturn.h: $(top_builddir)/config.status
-       rm -f $@
-endif
-MOSTLYCLEANFILES += stdnoreturn.h
-
-Include:
-<stdnoreturn.h>
-
-License:
-LGPLv2+
-
-Maintainer:
-all
diff --git a/modules/stdnoreturn-tests b/modules/stdnoreturn-tests
deleted file mode 100644
index 1d1f820..0000000
--- 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 e96d057..19e7a0b 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 aa60a82..d7ea438 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 b7c79f1..66e5342 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 fed5e54..0000000
--- a/tests/test-stdnoreturn.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/* Test of <stdnoreturn.h> 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 <http://www.gnu.org/licenses/>.  */
-
-/* written by Paul Eggert */
-
-#include <config.h>
-
-#include <stdnoreturn.h>
-
-/* 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;
-}



reply via email to

[Prev in Thread] Current Thread [Next in Thread]