Imported Upstream version 1.5.2 upstream/1.5.2
authorJinWang An <jinwang.an@samsung.com>
Thu, 23 Dec 2021 05:11:08 +0000 (14:11 +0900)
committerJinWang An <jinwang.an@samsung.com>
Thu, 23 Dec 2021 05:11:08 +0000 (14:11 +0900)
29 files changed:
ChangeLog
Makefile.in
NEWS
README
aclocal.m4
bootstrap.conf
configure
configure.ac
gl/lib/Makefile.am
gl/lib/Makefile.in
gl/m4/gnulib-comp.m4
gl/m4/manywarnings.m4 [new file with mode: 0644]
lib/Makefile.am
lib/Makefile.in
lib/debug.c
lib/libpipeline.pc.in
lib/pipeline.c
lib/pipeline.h
man/Makefile.in
man/libpipeline.3
tests/Makefile.in
tests/argstr.c
tests/basic.c
tests/common.h
tests/exec.c
tests/inspect.c
tests/pump.c
tests/read.c
tests/redirect.c

index dfec849..4be5522 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,98 @@
+2020-01-01  Colin Watson  <cjwatson@debian.org>
+
+       Version: 1.5.2
+
+       * lib/Makefile.am (libpipeline_la_LDFLAGS): Bump -version-info to 6:2:5.
+       * README: Update copyright dates.
+
+2020-01-01  Colin Watson  <cjwatson@debian.org>
+
+       * NEWS: Document pipeline_start doc change
+
+2020-01-01  Colin Watson  <cjwatson@debian.org>
+
+       pipecmd_exec: Flush stdio in PIPECMD_FUNCTION case
+
+       This fixes a regression in eceb4fc9c1a800739f3876a5c9538376adc77876
+       where we could lose some output from functions that write to standard
+       output but don't explicitly flush.
+
+       * lib/pipeline.c (pipecmd_exec): Flush output streams before exiting in
+       the PIPECMD_FUNCTION case.
+
+2020-01-01  Colin Watson  <cjwatson@debian.org>
+
+       pipeline_start: Document that standard FDs must be open
+
+       Fixes Ubuntu bug #992271.
+
+       * lib/pipeline.h (pipeline_start): Document that FDs 0, 1, and 2 must be
+       open before calling this function.
+       * man/libpipeline.3 (pipeline_start): Likewise.
+
+2019-12-27  Colin Watson  <cjwatson@debian.org>
+
+       Use _exit rather than exit in pipecmd_exec
+
+       This avoids bugs such as functions registered using atexit being called
+       multiple times.
+
+       * lib/pipeline.c (pipecmd_exec): Call _exit rather than exit.
+       * NEWS: Document this.
+
+2019-08-31  Colin Watson  <cjwatson@debian.org>
+
+       Enable many more GCC warnings
+
+       * bootstrap.conf (gnulib_modules): Add manywarnings.<Paste>
+       * configure.ac: Add gl_MANYWARN_ALL_GCC, with some refinements to disable
+       -Wsystem-headers, -Wmissing-field-initializers, and -Winline.
+
+2019-08-31  Colin Watson  <cjwatson@debian.org>
+
+       Add several function attributes suggested by GCC
+
+       * lib/debug.c (vdebug): Mark first argument as a printf format string.
+       * lib/pipeline.c (pipecmd_get_nargs, pipeline_get_ncommands,
+       pipeline_get_command, pipeline_get_pid, pipeline_peek_size): Mark as
+       pure.
+
+2019-08-31  Colin Watson  <cjwatson@debian.org>
+
+       Make several functions static
+
+       * tests/argstr.c (argstr_suite): Make static.
+       * tests/basic.c (basic_suite): Likewise.
+       * tests/exec.c (exec_suite): Likewise.
+       * tests/inspect.c (inspect_suite): Likewise.
+       * tests/pump.c (pump_suite): Likewise.
+       * tests/read.c (read_suite): Likewise.
+       * tests/redirect.c (redirect_suite): Likewise.
+
+2019-08-31  Colin Watson  <cjwatson@debian.org>
+
+       Simplify some GCC attribute handling
+
+       We have to be a little careful, as we can't use Gnulib in the public
+       <pipeline.h> header; but we can rely on it for internal compilation
+       units.
+
+       * lib/pipeline.c (passthrough): Use _GL_UNUSED rather than
+       PIPELINE_ATTR_UNUSED.
+       * tests/basic.c (pre_exec): Likewise.
+       * tests/common.h (MAIN): Likewise.
+       * tests/inspect.c (pid_helper): Likewise.
+       * tests/pump.c (tee_source): Likewise.
+       * lib/pipeline.h (PIPELINE_ATTR_UNUSED): Note that this is unused, but
+       preserved to avoid breaking (even undocumented) API.
+
+2019-01-30  Colin Watson  <cjwatson@debian.org>
+
+       Use HTTPS URL
+
+       * README, lib/libpipeline.pc.in (URL): Update homepage URL to
+       https://nongnu.org/libpipeline/.
+
 2019-01-27  Colin Watson  <cjwatson@debian.org>
 
        Version: 1.5.1
index 5e3a6b4..4bb158c 100644 (file)
@@ -124,6 +124,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/pipeline-socketpair.m4 \
        $(top_srcdir)/gl/m4/ltversion.m4 \
        $(top_srcdir)/gl/m4/lt~obsolete.m4 \
        $(top_srcdir)/gl/m4/malloc.m4 $(top_srcdir)/gl/m4/malloca.m4 \
+       $(top_srcdir)/gl/m4/manywarnings.m4 \
        $(top_srcdir)/gl/m4/memchr.m4 $(top_srcdir)/gl/m4/mkdir.m4 \
        $(top_srcdir)/gl/m4/mkdtemp.m4 \
        $(top_srcdir)/gl/m4/mmap-anon.m4 \
diff --git a/NEWS b/NEWS
index d534f55..c02c2c1 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,11 @@
+libpipeline 1.5.2 (1 January 2020)
+==================================
+
+`pipecmd_exec' now calls `_exit' rather than `exit', to avoid bugs such as
+functions registered using `atexit' being called multiple times.
+
+Document that standard FDs must be open before calling `pipeline_start'.
+
 libpipeline 1.5.1 (27 January 2019)
 ===================================
 
diff --git a/README b/README
index d8ffd94..5c95427 100644 (file)
--- a/README
+++ b/README
@@ -1,7 +1,7 @@
 libpipeline, a pipeline manipulation library
 ============================================
 
-  http://libpipeline.nongnu.org/
+  https://nongnu.org/libpipeline/
 
 libpipeline is a C library for setting up and running pipelines of
 processes, without needing to involve shell command-line parsing which is
@@ -59,7 +59,7 @@ Copyright (C) 1994 Markus Armbruster.
 Copyright (C) 1989, 1990, 1991, 1992, 2000, 2001, 2002, 2003, 2004, 2005,
               2006, 2007, 2008, 2009, 2010
               Free Software Foundation, Inc.
-Copyright (C) 2003-2017 Colin Watson.
+Copyright (C) 2003-2020 Colin Watson.
 
 libpipeline is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
index 0bd1e3c..ccc95f9 100644 (file)
@@ -2001,6 +2001,7 @@ m4_include([gl/m4/ltversion.m4])
 m4_include([gl/m4/lt~obsolete.m4])
 m4_include([gl/m4/malloc.m4])
 m4_include([gl/m4/malloca.m4])
+m4_include([gl/m4/manywarnings.m4])
 m4_include([gl/m4/memchr.m4])
 m4_include([gl/m4/mkdir.m4])
 m4_include([gl/m4/mkdtemp.m4])
index bdbb9e0..dae1110 100644 (file)
@@ -28,6 +28,7 @@ gnulib_modules="
   gnupload
   largefile
   lib-ignore
+  manywarnings
   mkdtemp
   safe-read
   safe-write
index 4103f97..357fb2f 100755 (executable)
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for libpipeline 1.5.1.
+# Generated by GNU Autoconf 2.69 for libpipeline 1.5.2.
 #
 # Report bugs to <cjwatson@debian.org>.
 #
@@ -590,8 +590,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='libpipeline'
 PACKAGE_TARNAME='libpipeline'
-PACKAGE_VERSION='1.5.1'
-PACKAGE_STRING='libpipeline 1.5.1'
+PACKAGE_VERSION='1.5.2'
+PACKAGE_STRING='libpipeline 1.5.2'
 PACKAGE_BUGREPORT='cjwatson@debian.org'
 PACKAGE_URL=''
 
@@ -2064,7 +2064,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures libpipeline 1.5.1 to adapt to many kinds of systems.
+\`configure' configures libpipeline 1.5.2 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -2135,7 +2135,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of libpipeline 1.5.1:";;
+     short | recursive ) echo "Configuration of libpipeline 1.5.2:";;
    esac
   cat <<\_ACEOF
 
@@ -2266,7 +2266,7 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-libpipeline configure 1.5.1
+libpipeline configure 1.5.2
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2519,173 +2519,6 @@ $as_echo "$ac_res" >&6; }
 
 } # ac_fn_c_check_header_compile
 
-# ac_fn_c_try_link LINENO
-# -----------------------
-# Try to link conftest.$ac_ext, and return whether this succeeded.
-ac_fn_c_try_link ()
-{
-  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  rm -f conftest.$ac_objext conftest$ac_exeext
-  if { { ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
-  (eval "$ac_link") 2>conftest.err
-  ac_status=$?
-  if test -s conftest.err; then
-    grep -v '^ *+' conftest.err >conftest.er1
-    cat conftest.er1 >&5
-    mv -f conftest.er1 conftest.err
-  fi
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; } && {
-        test -z "$ac_c_werror_flag" ||
-        test ! -s conftest.err
-       } && test -s conftest$ac_exeext && {
-        test "$cross_compiling" = yes ||
-        test -x conftest$ac_exeext
-       }; then :
-  ac_retval=0
-else
-  $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_retval=1
-fi
-  # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
-  # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
-  # interfere with the next link command; also delete a directory that is
-  # left behind by Apple's compiler.  We do this before executing the actions.
-  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-  as_fn_set_status $ac_retval
-
-} # ac_fn_c_try_link
-
-# ac_fn_c_check_func LINENO FUNC VAR
-# ----------------------------------
-# Tests whether FUNC exists, setting the cache variable VAR accordingly
-ac_fn_c_check_func ()
-{
-  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
-$as_echo_n "checking for $2... " >&6; }
-if eval \${$3+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-/* Define $2 to an innocuous variant, in case <limits.h> declares $2.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define $2 innocuous_$2
-
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $2 (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $2
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char $2 ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_$2 || defined __stub___$2
-choke me
-#endif
-
-int
-main ()
-{
-return $2 ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  eval "$3=yes"
-else
-  eval "$3=no"
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-fi
-eval ac_res=\$$3
-              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-
-} # ac_fn_c_check_func
-
-# ac_fn_c_check_type LINENO TYPE VAR INCLUDES
-# -------------------------------------------
-# Tests whether TYPE exists after having included INCLUDES, setting cache
-# variable VAR accordingly.
-ac_fn_c_check_type ()
-{
-  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
-  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
-$as_echo_n "checking for $2... " >&6; }
-if eval \${$3+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  eval "$3=no"
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$4
-int
-main ()
-{
-if (sizeof ($2))
-        return 0;
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-$4
-int
-main ()
-{
-if (sizeof (($2)))
-           return 0;
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-
-else
-  eval "$3=yes"
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-eval ac_res=\$$3
-              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-
-} # ac_fn_c_check_type
-
 # ac_fn_c_compute_int LINENO EXPR VAR INCLUDES
 # --------------------------------------------
 # Tries to find the compile-time value of EXPR in a program that includes
@@ -2869,6 +2702,173 @@ rm -f conftest.val
 
 } # ac_fn_c_compute_int
 
+# ac_fn_c_try_link LINENO
+# -----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_link ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  rm -f conftest.$ac_objext conftest$ac_exeext
+  if { { ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+  (eval "$ac_link") 2>conftest.err
+  ac_status=$?
+  if test -s conftest.err; then
+    grep -v '^ *+' conftest.err >conftest.er1
+    cat conftest.er1 >&5
+    mv -f conftest.er1 conftest.err
+  fi
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } && {
+        test -z "$ac_c_werror_flag" ||
+        test ! -s conftest.err
+       } && test -s conftest$ac_exeext && {
+        test "$cross_compiling" = yes ||
+        test -x conftest$ac_exeext
+       }; then :
+  ac_retval=0
+else
+  $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+       ac_retval=1
+fi
+  # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
+  # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
+  # interfere with the next link command; also delete a directory that is
+  # left behind by Apple's compiler.  We do this before executing the actions.
+  rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+  as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_link
+
+# ac_fn_c_check_func LINENO FUNC VAR
+# ----------------------------------
+# Tests whether FUNC exists, setting the cache variable VAR accordingly
+ac_fn_c_check_func ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+/* Define $2 to an innocuous variant, in case <limits.h> declares $2.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define $2 innocuous_$2
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $2 (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $2
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char $2 ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined __stub_$2 || defined __stub___$2
+choke me
+#endif
+
+int
+main ()
+{
+return $2 ();
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  eval "$3=yes"
+else
+  eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_func
+
+# ac_fn_c_check_type LINENO TYPE VAR INCLUDES
+# -------------------------------------------
+# Tests whether TYPE exists after having included INCLUDES, setting cache
+# variable VAR accordingly.
+ac_fn_c_check_type ()
+{
+  as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  eval "$3=no"
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+if (sizeof ($2))
+        return 0;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+$4
+int
+main ()
+{
+if (sizeof (($2)))
+           return 0;
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+else
+  eval "$3=yes"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+  eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_type
+
 # ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES
 # ---------------------------------------------
 # Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR
@@ -2975,7 +2975,7 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by libpipeline $as_me 1.5.1, which was
+It was created by libpipeline $as_me 1.5.2, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -3865,7 +3865,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='libpipeline'
- VERSION='1.5.1'
+ VERSION='1.5.2'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -7415,6 +7415,7 @@ fi
   # Code from module lstat:
   # Code from module malloc-posix:
   # Code from module malloca:
+  # Code from module manywarnings:
   # Code from module memchr:
   # Code from module mkdir:
   # Code from module mkdtemp:
@@ -7621,52 +7622,7 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
 ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 CFLAGS="$CFLAGS -Wall"
-if test "$GCC" = yes
-then
-
-  ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler handles -Werror -Wunknown-warning-option" >&5
-$as_echo_n "checking whether C compiler handles -Werror -Wunknown-warning-option... " >&6; }
-if ${gl_cv_warn_c__Werror__Wunknown_warning_option+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-
-  gl_save_compiler_FLAGS="$CFLAGS"
-  as_fn_append CFLAGS " $gl_unknown_warnings_are_errors -Werror -Wunknown-warning-option"
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  gl_cv_warn_c__Werror__Wunknown_warning_option=yes
-else
-  gl_cv_warn_c__Werror__Wunknown_warning_option=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-  CFLAGS="$gl_save_compiler_FLAGS"
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_warn_c__Werror__Wunknown_warning_option" >&5
-$as_echo "$gl_cv_warn_c__Werror__Wunknown_warning_option" >&6; }
-if test "x$gl_cv_warn_c__Werror__Wunknown_warning_option" = xyes; then :
-  gl_unknown_warnings_are_errors='-Wunknown-warning-option -Werror'
-else
-  gl_unknown_warnings_are_errors=
-fi
+# Enable all reasonable GCC warnings.
 
   ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
@@ -7676,16 +7632,16 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
 
+  if test -n "$GCC"; then
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler handles -W" >&5
-$as_echo_n "checking whether C compiler handles -W... " >&6; }
-if ${gl_cv_warn_c__W+:} false; then :
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -Wno-missing-field-initializers is supported" >&5
+$as_echo_n "checking whether -Wno-missing-field-initializers is supported... " >&6; }
+if ${gl_cv_cc_nomfi_supported+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-
-  gl_save_compiler_FLAGS="$CFLAGS"
-  as_fn_append CFLAGS " $gl_unknown_warnings_are_errors -W"
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+  gl_save_CFLAGS="$CFLAGS"
+       CFLAGS="$CFLAGS -W -Werror -Wno-missing-field-initializers"
+       cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -7696,35 +7652,34 @@ main ()
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  gl_cv_warn_c__W=yes
+if ac_fn_c_try_compile "$LINENO"; then :
+  gl_cv_cc_nomfi_supported=yes
 else
-  gl_cv_warn_c__W=no
+  gl_cv_cc_nomfi_supported=no
 fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-  CFLAGS="$gl_save_compiler_FLAGS"
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+       CFLAGS="$gl_save_CFLAGS"
 
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_warn_c__W" >&5
-$as_echo "$gl_cv_warn_c__W" >&6; }
-if test "x$gl_cv_warn_c__W" = xyes; then :
-  as_fn_append WARN_CFLAGS " -W"
-fi
-
-
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_cc_nomfi_supported" >&5
+$as_echo "$gl_cv_cc_nomfi_supported" >&6; }
 
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler handles -Wpointer-arith" >&5
-$as_echo_n "checking whether C compiler handles -Wpointer-arith... " >&6; }
-if ${gl_cv_warn_c__Wpointer_arith+:} false; then :
+    if test "$gl_cv_cc_nomfi_supported" = yes; then
+                  { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -Wno-missing-field-initializers is needed" >&5
+$as_echo_n "checking whether -Wno-missing-field-initializers is needed... " >&6; }
+if ${gl_cv_cc_nomfi_needed+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-
-  gl_save_compiler_FLAGS="$CFLAGS"
-  as_fn_append CFLAGS " $gl_unknown_warnings_are_errors -Wpointer-arith"
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+  gl_save_CFLAGS="$CFLAGS"
+         CFLAGS="$CFLAGS -W -Werror"
+         cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
+int f (void)
+                {
+                  typedef struct { int a; int b; } s_t;
+                  s_t s1 = { 0, };
+                  return s1.b;
+                }
 
 int
 main ()
@@ -7734,34 +7689,27 @@ main ()
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  gl_cv_warn_c__Wpointer_arith=yes
+if ac_fn_c_try_compile "$LINENO"; then :
+  gl_cv_cc_nomfi_needed=no
 else
-  gl_cv_warn_c__Wpointer_arith=no
+  gl_cv_cc_nomfi_needed=yes
 fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-  CFLAGS="$gl_save_compiler_FLAGS"
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+         CFLAGS="$gl_save_CFLAGS"
 
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_warn_c__Wpointer_arith" >&5
-$as_echo "$gl_cv_warn_c__Wpointer_arith" >&6; }
-if test "x$gl_cv_warn_c__Wpointer_arith" = xyes; then :
-  as_fn_append WARN_CFLAGS " -Wpointer-arith"
-fi
-
-
-
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_cc_nomfi_needed" >&5
+$as_echo "$gl_cv_cc_nomfi_needed" >&6; }
+    fi
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler handles -Wwrite-strings" >&5
-$as_echo_n "checking whether C compiler handles -Wwrite-strings... " >&6; }
-if ${gl_cv_warn_c__Wwrite_strings+:} false; then :
+                { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -Wuninitialized is supported" >&5
+$as_echo_n "checking whether -Wuninitialized is supported... " >&6; }
+if ${gl_cv_cc_uninitialized_supported+:} false; then :
   $as_echo_n "(cached) " >&6
 else
-
-  gl_save_compiler_FLAGS="$CFLAGS"
-  as_fn_append CFLAGS " $gl_unknown_warnings_are_errors -Wwrite-strings"
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+  gl_save_CFLAGS="$CFLAGS"
+       CFLAGS="$CFLAGS -Werror -Wuninitialized"
+       cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
 int
@@ -7772,109 +7720,289 @@ main ()
   return 0;
 }
 _ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  gl_cv_warn_c__Wwrite_strings=yes
+if ac_fn_c_try_compile "$LINENO"; then :
+  gl_cv_cc_uninitialized_supported=yes
 else
-  gl_cv_warn_c__Wwrite_strings=no
+  gl_cv_cc_uninitialized_supported=no
 fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-  CFLAGS="$gl_save_compiler_FLAGS"
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+       CFLAGS="$gl_save_CFLAGS"
 
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_warn_c__Wwrite_strings" >&5
-$as_echo "$gl_cv_warn_c__Wwrite_strings" >&6; }
-if test "x$gl_cv_warn_c__Wwrite_strings" = xyes; then :
-  as_fn_append WARN_CFLAGS " -Wwrite-strings"
-fi
-
-
-
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_cc_uninitialized_supported" >&5
+$as_echo "$gl_cv_cc_uninitialized_supported" >&6; }
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler handles -Wstrict-prototypes" >&5
-$as_echo_n "checking whether C compiler handles -Wstrict-prototypes... " >&6; }
-if ${gl_cv_warn_c__Wstrict_prototypes+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
+  fi
 
-  gl_save_compiler_FLAGS="$CFLAGS"
-  as_fn_append CFLAGS " $gl_unknown_warnings_are_errors -Wstrict-prototypes"
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
+  # List all gcc warning categories.
+  # To compare this list to your installed GCC's, run this Bash command:
+  #
+  # comm -3 \
+  #  <((sed -n 's/^  *\(-[^ 0-9][^ ]*\) .*/\1/p' manywarnings.m4; \
+  #     awk '/^[^#]/ {print warnings}' ../build-aux/gcc-warning.spec) | sort) \
+  #  <(LC_ALL=C gcc --help=warnings | sed -n 's/^  \(-[^ ]*\) .*/\1/p' | sort)
+
+  gl_manywarn_set=
+  for gl_manywarn_item in -fno-common \
+    -W \
+    -Waddress \
+    -Waggressive-loop-optimizations \
+    -Wall \
+    -Wattribute-alias \
+    -Wattributes \
+    -Wbad-function-cast \
+    -Wbool-compare \
+    -Wbool-operation \
+    -Wbuiltin-declaration-mismatch \
+    -Wbuiltin-macro-redefined \
+    -Wcast-align \
+    -Wcast-align=strict \
+    -Wcast-function-type \
+    -Wchar-subscripts \
+    -Wclobbered \
+    -Wcomment \
+    -Wcomments \
+    -Wcoverage-mismatch \
+    -Wcpp \
+    -Wdangling-else \
+    -Wdate-time \
+    -Wdeprecated \
+    -Wdeprecated-declarations \
+    -Wdesignated-init \
+    -Wdisabled-optimization \
+    -Wdiscarded-array-qualifiers \
+    -Wdiscarded-qualifiers \
+    -Wdiv-by-zero \
+    -Wdouble-promotion \
+    -Wduplicated-branches \
+    -Wduplicated-cond \
+    -Wduplicate-decl-specifier \
+    -Wempty-body \
+    -Wendif-labels \
+    -Wenum-compare \
+    -Wexpansion-to-defined \
+    -Wextra \
+    -Wformat-contains-nul \
+    -Wformat-extra-args \
+    -Wformat-nonliteral \
+    -Wformat-security \
+    -Wformat-signedness \
+    -Wformat-y2k \
+    -Wformat-zero-length \
+    -Wframe-address \
+    -Wfree-nonheap-object \
+    -Whsa \
+    -Wif-not-aligned \
+    -Wignored-attributes \
+    -Wignored-qualifiers \
+    -Wimplicit \
+    -Wimplicit-function-declaration \
+    -Wimplicit-int \
+    -Wincompatible-pointer-types \
+    -Winit-self \
+    -Winline \
+    -Wint-conversion \
+    -Wint-in-bool-context \
+    -Wint-to-pointer-cast \
+    -Winvalid-memory-model \
+    -Winvalid-pch \
+    -Wlogical-not-parentheses \
+    -Wlogical-op \
+    -Wmain \
+    -Wmaybe-uninitialized \
+    -Wmemset-elt-size \
+    -Wmemset-transposed-args \
+    -Wmisleading-indentation \
+    -Wmissing-attributes \
+    -Wmissing-braces \
+    -Wmissing-declarations \
+    -Wmissing-field-initializers \
+    -Wmissing-include-dirs \
+    -Wmissing-parameter-type \
+    -Wmissing-prototypes \
+    -Wmultichar \
+    -Wmultistatement-macros \
+    -Wnarrowing \
+    -Wnested-externs \
+    -Wnonnull \
+    -Wnonnull-compare \
+    -Wnull-dereference \
+    -Wodr \
+    -Wold-style-declaration \
+    -Wold-style-definition \
+    -Wopenmp-simd \
+    -Woverflow \
+    -Woverlength-strings \
+    -Woverride-init \
+    -Wpacked \
+    -Wpacked-bitfield-compat \
+    -Wpacked-not-aligned \
+    -Wparentheses \
+    -Wpointer-arith \
+    -Wpointer-compare \
+    -Wpointer-sign \
+    -Wpointer-to-int-cast \
+    -Wpragmas \
+    -Wpsabi \
+    -Wrestrict \
+    -Wreturn-local-addr \
+    -Wreturn-type \
+    -Wscalar-storage-order \
+    -Wsequence-point \
+    -Wshadow \
+    -Wshift-count-negative \
+    -Wshift-count-overflow \
+    -Wshift-negative-value \
+    -Wsizeof-array-argument \
+    -Wsizeof-pointer-div \
+    -Wsizeof-pointer-memaccess \
+    -Wstack-protector \
+    -Wstrict-aliasing \
+    -Wstrict-overflow \
+    -Wstrict-prototypes \
+    -Wstringop-truncation \
+    -Wsuggest-attribute=cold \
+    -Wsuggest-attribute=const \
+    -Wsuggest-attribute=format \
+    -Wsuggest-attribute=malloc \
+    -Wsuggest-attribute=noreturn \
+    -Wsuggest-attribute=pure \
+    -Wsuggest-final-methods \
+    -Wsuggest-final-types \
+    -Wswitch \
+    -Wswitch-bool \
+    -Wswitch-unreachable \
+    -Wsync-nand \
+    -Wsystem-headers \
+    -Wtautological-compare \
+    -Wtrampolines \
+    -Wtrigraphs \
+    -Wtype-limits \
+    -Wuninitialized \
+    -Wunknown-pragmas \
+    -Wunsafe-loop-optimizations \
+    -Wunused \
+    -Wunused-but-set-parameter \
+    -Wunused-but-set-variable \
+    -Wunused-function \
+    -Wunused-label \
+    -Wunused-local-typedefs \
+    -Wunused-macros \
+    -Wunused-parameter \
+    -Wunused-result \
+    -Wunused-value \
+    -Wunused-variable \
+    -Wvarargs \
+    -Wvariadic-macros \
+    -Wvector-operation-performance \
+    -Wvla \
+    -Wvolatile-register-var \
+    -Wwrite-strings \
+    \
+    ; do
+    gl_manywarn_set="$gl_manywarn_set $gl_manywarn_item"
+  done
 
-int
-main ()
-{
+  # gcc --help=warnings outputs an unusual form for these options; list
+  # them here so that the above 'comm' command doesn't report a false match.
+  # Would prefer "min (PTRDIFF_MAX, SIZE_MAX)", but it must be a literal.
+  # Also, AC_COMPUTE_INT requires it to fit in a long; it is 2**63 on
+  # the only platforms where it does not fit in a long, so make that
+  # a special case.
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking max safe object size" >&5
+$as_echo_n "checking max safe object size... " >&6; }
+  if ac_fn_c_compute_int "$LINENO" "LONG_MAX < (PTRDIFF_MAX < (size_t) -1 ? PTRDIFF_MAX : (size_t) -1)
+     ? -1
+     : PTRDIFF_MAX < (size_t) -1 ? (long) PTRDIFF_MAX : (long) (size_t) -1" "gl_alloc_max"        "#include <limits.h>
+      #include <stddef.h>
+      #include <stdint.h>
+    "; then :
 
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  gl_cv_warn_c__Wstrict_prototypes=yes
 else
-  gl_cv_warn_c__Wstrict_prototypes=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-  CFLAGS="$gl_save_compiler_FLAGS"
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_warn_c__Wstrict_prototypes" >&5
-$as_echo "$gl_cv_warn_c__Wstrict_prototypes" >&6; }
-if test "x$gl_cv_warn_c__Wstrict_prototypes" = xyes; then :
-  as_fn_append WARN_CFLAGS " -Wstrict-prototypes"
+  gl_alloc_max=2147483647
 fi
 
+  case $gl_alloc_max in
+    -1) gl_alloc_max=9223372036854775807;;
+  esac
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_alloc_max" >&5
+$as_echo "$gl_alloc_max" >&6; }
+  gl_manywarn_set="$gl_manywarn_set -Walloc-size-larger-than=$gl_alloc_max"
+  gl_manywarn_set="$gl_manywarn_set -Warray-bounds=2"
+  gl_manywarn_set="$gl_manywarn_set -Wformat-overflow=2"
+  gl_manywarn_set="$gl_manywarn_set -Wformat-truncation=2"
+  gl_manywarn_set="$gl_manywarn_set -Wimplicit-fallthrough=5"
+  gl_manywarn_set="$gl_manywarn_set -Wnormalized=nfc"
+  gl_manywarn_set="$gl_manywarn_set -Wshift-overflow=2"
+  gl_manywarn_set="$gl_manywarn_set -Wstringop-overflow=2"
+  gl_manywarn_set="$gl_manywarn_set -Wunused-const-variable=2"
+  gl_manywarn_set="$gl_manywarn_set -Wvla-larger-than=4031"
+
+  # These are needed for older GCC versions.
+  if test -n "$GCC"; then
+    case `($CC --version) 2>/dev/null` in
+      'gcc (GCC) '[0-3].* | \
+      'gcc (GCC) '4.[0-7].*)
+        gl_manywarn_set="$gl_manywarn_set -fdiagnostics-show-option"
+        gl_manywarn_set="$gl_manywarn_set -funit-at-a-time"
+          ;;
+    esac
+  fi
 
+  # Disable specific options as needed.
+  if test "$gl_cv_cc_nomfi_needed" = yes; then
+    gl_manywarn_set="$gl_manywarn_set -Wno-missing-field-initializers"
+  fi
 
+  if test "$gl_cv_cc_uninitialized_supported" = no; then
+    gl_manywarn_set="$gl_manywarn_set -Wno-uninitialized"
+  fi
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler handles -Wshadow" >&5
-$as_echo_n "checking whether C compiler handles -Wshadow... " >&6; }
-if ${gl_cv_warn_c__Wshadow+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
+  warnings=$gl_manywarn_set
 
-  gl_save_compiler_FLAGS="$CFLAGS"
-  as_fn_append CFLAGS " $gl_unknown_warnings_are_errors -Wshadow"
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
+  ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
-int
-main ()
-{
 
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-  gl_cv_warn_c__Wshadow=yes
-else
-  gl_cv_warn_c__Wshadow=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-  CFLAGS="$gl_save_compiler_FLAGS"
+nw=
+nw="$nw -Wsystem-headers"
+nw="$nw -Wmissing-field-initializers"
+nw="$nw -Winline"
 
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_warn_c__Wshadow" >&5
-$as_echo "$gl_cv_warn_c__Wshadow" >&6; }
-if test "x$gl_cv_warn_c__Wshadow" = xyes; then :
-  as_fn_append WARN_CFLAGS " -Wshadow"
-fi
+  gl_warn_set=
+  set x $warnings; shift
+  for gl_warn_item
+  do
+    case " $nw " in
+      *" $gl_warn_item "*)
+        ;;
+      *)
+        gl_warn_set="$gl_warn_set $gl_warn_item"
+        ;;
+    esac
+  done
+  warnings=$gl_warn_set
 
+for w in $warnings; do
 
+  ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler handles -Wformat-security" >&5
-$as_echo_n "checking whether C compiler handles -Wformat-security... " >&6; }
-if ${gl_cv_warn_c__Wformat_security+:} false; then :
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler handles -Werror -Wunknown-warning-option" >&5
+$as_echo_n "checking whether C compiler handles -Werror -Wunknown-warning-option... " >&6; }
+if ${gl_cv_warn_c__Werror__Wunknown_warning_option+:} false; then :
   $as_echo_n "(cached) " >&6
 else
 
   gl_save_compiler_FLAGS="$CFLAGS"
-  as_fn_append CFLAGS " $gl_unknown_warnings_are_errors -Wformat-security"
+  as_fn_append CFLAGS " $gl_unknown_warnings_are_errors -Werror -Wunknown-warning-option"
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -7887,32 +8015,45 @@ main ()
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  gl_cv_warn_c__Wformat_security=yes
+  gl_cv_warn_c__Werror__Wunknown_warning_option=yes
 else
-  gl_cv_warn_c__Wformat_security=no
+  gl_cv_warn_c__Werror__Wunknown_warning_option=no
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
   CFLAGS="$gl_save_compiler_FLAGS"
 
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_warn_c__Wformat_security" >&5
-$as_echo "$gl_cv_warn_c__Wformat_security" >&6; }
-if test "x$gl_cv_warn_c__Wformat_security" = xyes; then :
-  as_fn_append WARN_CFLAGS " -Wformat-security"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_warn_c__Werror__Wunknown_warning_option" >&5
+$as_echo "$gl_cv_warn_c__Werror__Wunknown_warning_option" >&6; }
+if test "x$gl_cv_warn_c__Werror__Wunknown_warning_option" = xyes; then :
+  gl_unknown_warnings_are_errors='-Wunknown-warning-option -Werror'
+else
+  gl_unknown_warnings_are_errors=
 fi
 
+  ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
 
 
 
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler handles -Wredundant-decls" >&5
-$as_echo_n "checking whether C compiler handles -Wredundant-decls... " >&6; }
-if ${gl_cv_warn_c__Wredundant_decls+:} false; then :
+as_gl_Warn=`$as_echo "gl_cv_warn_c_$w" | $as_tr_sh`
+gl_positive="$w"
+case $gl_positive in
+  -Wno-*) gl_positive=-W`expr "X$gl_positive" : 'X-Wno-\(.*\)'` ;;
+esac
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler handles $w" >&5
+$as_echo_n "checking whether C compiler handles $w... " >&6; }
+if eval \${$as_gl_Warn+:} false; then :
   $as_echo_n "(cached) " >&6
 else
 
   gl_save_compiler_FLAGS="$CFLAGS"
-  as_fn_append CFLAGS " $gl_unknown_warnings_are_errors -Wredundant-decls"
+  as_fn_append CFLAGS " $gl_unknown_warnings_are_errors $gl_positive"
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -7925,22 +8066,24 @@ main ()
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  gl_cv_warn_c__Wredundant_decls=yes
+  eval "$as_gl_Warn=yes"
 else
-  gl_cv_warn_c__Wredundant_decls=no
+  eval "$as_gl_Warn=no"
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
   CFLAGS="$gl_save_compiler_FLAGS"
 
 fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_warn_c__Wredundant_decls" >&5
-$as_echo "$gl_cv_warn_c__Wredundant_decls" >&6; }
-if test "x$gl_cv_warn_c__Wredundant_decls" = xyes; then :
-  as_fn_append WARN_CFLAGS " -Wredundant-decls"
+eval ac_res=\$$as_gl_Warn
+              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+if eval test \"x\$"$as_gl_Warn"\" = x"yes"; then :
+  as_fn_append WARN_CFLAGS " $w"
 fi
 
 
+done
 
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler handles -Wno-missing-field-initializers" >&5
@@ -7979,7 +8122,6 @@ if test "x$gl_cv_warn_c__Wno_missing_field_initializers" = xyes; then :
 fi
 
 
-fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5
 $as_echo_n "checking whether ln -s works... " >&6; }
 LN_S=$as_ln_s
@@ -28522,7 +28664,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by libpipeline $as_me 1.5.1, which was
+This file was extended by libpipeline $as_me 1.5.2, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -28588,7 +28730,7 @@ _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-libpipeline config.status 1.5.1
+libpipeline config.status 1.5.2
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
index e6ce1fb..2ea49c6 100644 (file)
@@ -1,6 +1,6 @@
 dnl Process this file with autoconf to produce a configure script.
 
-# Copyright (C) 2010-2019 Colin Watson.
+# Copyright (C) 2010-2020 Colin Watson.
 #
 # This file is part of libpipeline.
 #
@@ -22,7 +22,7 @@ dnl Process this file with autoconf to produce a configure script.
 m4_pattern_forbid([^PIPELINE_])
 
 # Initialise and check we're in the correct directory.
-AC_INIT([libpipeline], [1.5.1], [cjwatson@debian.org])
+AC_INIT([libpipeline], [1.5.2], [cjwatson@debian.org])
 AC_CONFIG_AUX_DIR([build-aux])
 AM_INIT_AUTOMAKE([1.11 -Wall -Werror foreign])
 AM_MAINTAINER_MODE
@@ -40,17 +40,17 @@ AC_PROG_CC
 gl_EARLY
 AC_PROG_CPP
 CFLAGS="$CFLAGS -Wall"
-if test "$GCC" = yes
-then
-       gl_WARN_ADD([-W])
-       gl_WARN_ADD([-Wpointer-arith])
-       gl_WARN_ADD([-Wwrite-strings])
-       gl_WARN_ADD([-Wstrict-prototypes])
-       gl_WARN_ADD([-Wshadow])
-       gl_WARN_ADD([-Wformat-security])
-       gl_WARN_ADD([-Wredundant-decls])
-       gl_WARN_ADD([-Wno-missing-field-initializers])
-fi
+# Enable all reasonable GCC warnings.
+gl_MANYWARN_ALL_GCC([warnings])
+nw=
+nw="$nw -Wsystem-headers"
+nw="$nw -Wmissing-field-initializers"
+nw="$nw -Winline"
+gl_MANYWARN_COMPLEMENT([warnings], [$warnings], [$nw])
+for w in $warnings; do
+       gl_WARN_ADD([$w])
+done
+gl_WARN_ADD([-Wno-missing-field-initializers])
 AC_PROG_LN_S
 AM_PROG_AR
 LT_INIT([disable-static])
index 574d420..c66b72e 100644 (file)
@@ -41,6 +41,7 @@
 #  gnupload \
 #  largefile \
 #  lib-ignore \
+#  manywarnings \
 #  mkdtemp \
 #  safe-read \
 #  safe-write \
index 66d2b6d..d7b9af6 100644 (file)
@@ -55,6 +55,7 @@
 #  gnupload \
 #  largefile \
 #  lib-ignore \
+#  manywarnings \
 #  mkdtemp \
 #  safe-read \
 #  safe-write \
@@ -184,6 +185,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/pipeline-socketpair.m4 \
        $(top_srcdir)/gl/m4/ltversion.m4 \
        $(top_srcdir)/gl/m4/lt~obsolete.m4 \
        $(top_srcdir)/gl/m4/malloc.m4 $(top_srcdir)/gl/m4/malloca.m4 \
+       $(top_srcdir)/gl/m4/manywarnings.m4 \
        $(top_srcdir)/gl/m4/memchr.m4 $(top_srcdir)/gl/m4/mkdir.m4 \
        $(top_srcdir)/gl/m4/mkdtemp.m4 \
        $(top_srcdir)/gl/m4/mmap-anon.m4 \
index d506bb1..b1a3127 100644 (file)
@@ -76,6 +76,7 @@ AC_DEFUN([gl_EARLY],
   # Code from module lstat:
   # Code from module malloc-posix:
   # Code from module malloca:
+  # Code from module manywarnings:
   # Code from module memchr:
   # Code from module mkdir:
   # Code from module mkdtemp:
@@ -661,6 +662,8 @@ AC_DEFUN([gl_FILE_LIST], [
   m4/lstat.m4
   m4/malloc.m4
   m4/malloca.m4
+  m4/manywarnings-c++.m4
+  m4/manywarnings.m4
   m4/math_h.m4
   m4/memchr.m4
   m4/mkdir.m4
diff --git a/gl/m4/manywarnings.m4 b/gl/m4/manywarnings.m4
new file mode 100644 (file)
index 0000000..e0488a5
--- /dev/null
@@ -0,0 +1,334 @@
+# manywarnings.m4 serial 17
+dnl Copyright (C) 2008-2019 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.
+
+dnl From Simon Josefsson
+
+# gl_MANYWARN_COMPLEMENT(OUTVAR, LISTVAR, REMOVEVAR)
+# --------------------------------------------------
+# Copy LISTVAR to OUTVAR except for the entries in REMOVEVAR.
+# Elements separated by whitespace.  In set logic terms, the function
+# does OUTVAR = LISTVAR \ REMOVEVAR.
+AC_DEFUN([gl_MANYWARN_COMPLEMENT],
+[
+  gl_warn_set=
+  set x $2; shift
+  for gl_warn_item
+  do
+    case " $3 " in
+      *" $gl_warn_item "*)
+        ;;
+      *)
+        gl_warn_set="$gl_warn_set $gl_warn_item"
+        ;;
+    esac
+  done
+  $1=$gl_warn_set
+])
+
+# gl_MANYWARN_ALL_GCC(VARIABLE)
+# -----------------------------
+# Add all documented GCC warning parameters to variable VARIABLE.
+# Note that you need to test them using gl_WARN_ADD if you want to
+# make sure your gcc understands it.
+#
+# The effects of this macro depend on the current language (_AC_LANG).
+AC_DEFUN([gl_MANYWARN_ALL_GCC],
+[_AC_LANG_DISPATCH([$0], _AC_LANG, $@)])
+
+# Specialization for _AC_LANG = C.
+# Use of m4_defun rather than AC_DEFUN works around a bug in autoconf < 2.63b.
+m4_defun([gl_MANYWARN_ALL_GCC(C)],
+[
+  AC_LANG_PUSH([C])
+
+  dnl First, check for some issues that only occur when combining multiple
+  dnl gcc warning categories.
+  AC_REQUIRE([AC_PROG_CC])
+  if test -n "$GCC"; then
+
+    dnl Check if -W -Werror -Wno-missing-field-initializers is supported
+    dnl with the current $CC $CFLAGS $CPPFLAGS.
+    AC_CACHE_CHECK([whether -Wno-missing-field-initializers is supported],
+      [gl_cv_cc_nomfi_supported],
+      [gl_save_CFLAGS="$CFLAGS"
+       CFLAGS="$CFLAGS -W -Werror -Wno-missing-field-initializers"
+       AC_COMPILE_IFELSE(
+         [AC_LANG_PROGRAM([[]], [[]])],
+         [gl_cv_cc_nomfi_supported=yes],
+         [gl_cv_cc_nomfi_supported=no])
+       CFLAGS="$gl_save_CFLAGS"
+      ])
+
+    if test "$gl_cv_cc_nomfi_supported" = yes; then
+      dnl Now check whether -Wno-missing-field-initializers is needed
+      dnl for the { 0, } construct.
+      AC_CACHE_CHECK([whether -Wno-missing-field-initializers is needed],
+        [gl_cv_cc_nomfi_needed],
+        [gl_save_CFLAGS="$CFLAGS"
+         CFLAGS="$CFLAGS -W -Werror"
+         AC_COMPILE_IFELSE(
+           [AC_LANG_PROGRAM(
+              [[int f (void)
+                {
+                  typedef struct { int a; int b; } s_t;
+                  s_t s1 = { 0, };
+                  return s1.b;
+                }
+              ]],
+              [[]])],
+           [gl_cv_cc_nomfi_needed=no],
+           [gl_cv_cc_nomfi_needed=yes])
+         CFLAGS="$gl_save_CFLAGS"
+        ])
+    fi
+
+    dnl Next, check if -Werror -Wuninitialized is useful with the
+    dnl user's choice of $CFLAGS; some versions of gcc warn that it
+    dnl has no effect if -O is not also used
+    AC_CACHE_CHECK([whether -Wuninitialized is supported],
+      [gl_cv_cc_uninitialized_supported],
+      [gl_save_CFLAGS="$CFLAGS"
+       CFLAGS="$CFLAGS -Werror -Wuninitialized"
+       AC_COMPILE_IFELSE(
+         [AC_LANG_PROGRAM([[]], [[]])],
+         [gl_cv_cc_uninitialized_supported=yes],
+         [gl_cv_cc_uninitialized_supported=no])
+       CFLAGS="$gl_save_CFLAGS"
+      ])
+
+  fi
+
+  # List all gcc warning categories.
+  # To compare this list to your installed GCC's, run this Bash command:
+  #
+  # comm -3 \
+  #  <((sed -n 's/^  *\(-[^ 0-9][^ ]*\) .*/\1/p' manywarnings.m4; \
+  #     awk '/^[^#]/ {print $1}' ../build-aux/gcc-warning.spec) | sort) \
+  #  <(LC_ALL=C gcc --help=warnings | sed -n 's/^  \(-[^ ]*\) .*/\1/p' | sort)
+
+  gl_manywarn_set=
+  for gl_manywarn_item in -fno-common \
+    -W \
+    -Waddress \
+    -Waggressive-loop-optimizations \
+    -Wall \
+    -Wattribute-alias \
+    -Wattributes \
+    -Wbad-function-cast \
+    -Wbool-compare \
+    -Wbool-operation \
+    -Wbuiltin-declaration-mismatch \
+    -Wbuiltin-macro-redefined \
+    -Wcast-align \
+    -Wcast-align=strict \
+    -Wcast-function-type \
+    -Wchar-subscripts \
+    -Wclobbered \
+    -Wcomment \
+    -Wcomments \
+    -Wcoverage-mismatch \
+    -Wcpp \
+    -Wdangling-else \
+    -Wdate-time \
+    -Wdeprecated \
+    -Wdeprecated-declarations \
+    -Wdesignated-init \
+    -Wdisabled-optimization \
+    -Wdiscarded-array-qualifiers \
+    -Wdiscarded-qualifiers \
+    -Wdiv-by-zero \
+    -Wdouble-promotion \
+    -Wduplicated-branches \
+    -Wduplicated-cond \
+    -Wduplicate-decl-specifier \
+    -Wempty-body \
+    -Wendif-labels \
+    -Wenum-compare \
+    -Wexpansion-to-defined \
+    -Wextra \
+    -Wformat-contains-nul \
+    -Wformat-extra-args \
+    -Wformat-nonliteral \
+    -Wformat-security \
+    -Wformat-signedness \
+    -Wformat-y2k \
+    -Wformat-zero-length \
+    -Wframe-address \
+    -Wfree-nonheap-object \
+    -Whsa \
+    -Wif-not-aligned \
+    -Wignored-attributes \
+    -Wignored-qualifiers \
+    -Wimplicit \
+    -Wimplicit-function-declaration \
+    -Wimplicit-int \
+    -Wincompatible-pointer-types \
+    -Winit-self \
+    -Winline \
+    -Wint-conversion \
+    -Wint-in-bool-context \
+    -Wint-to-pointer-cast \
+    -Winvalid-memory-model \
+    -Winvalid-pch \
+    -Wlogical-not-parentheses \
+    -Wlogical-op \
+    -Wmain \
+    -Wmaybe-uninitialized \
+    -Wmemset-elt-size \
+    -Wmemset-transposed-args \
+    -Wmisleading-indentation \
+    -Wmissing-attributes \
+    -Wmissing-braces \
+    -Wmissing-declarations \
+    -Wmissing-field-initializers \
+    -Wmissing-include-dirs \
+    -Wmissing-parameter-type \
+    -Wmissing-prototypes \
+    -Wmultichar \
+    -Wmultistatement-macros \
+    -Wnarrowing \
+    -Wnested-externs \
+    -Wnonnull \
+    -Wnonnull-compare \
+    -Wnull-dereference \
+    -Wodr \
+    -Wold-style-declaration \
+    -Wold-style-definition \
+    -Wopenmp-simd \
+    -Woverflow \
+    -Woverlength-strings \
+    -Woverride-init \
+    -Wpacked \
+    -Wpacked-bitfield-compat \
+    -Wpacked-not-aligned \
+    -Wparentheses \
+    -Wpointer-arith \
+    -Wpointer-compare \
+    -Wpointer-sign \
+    -Wpointer-to-int-cast \
+    -Wpragmas \
+    -Wpsabi \
+    -Wrestrict \
+    -Wreturn-local-addr \
+    -Wreturn-type \
+    -Wscalar-storage-order \
+    -Wsequence-point \
+    -Wshadow \
+    -Wshift-count-negative \
+    -Wshift-count-overflow \
+    -Wshift-negative-value \
+    -Wsizeof-array-argument \
+    -Wsizeof-pointer-div \
+    -Wsizeof-pointer-memaccess \
+    -Wstack-protector \
+    -Wstrict-aliasing \
+    -Wstrict-overflow \
+    -Wstrict-prototypes \
+    -Wstringop-truncation \
+    -Wsuggest-attribute=cold \
+    -Wsuggest-attribute=const \
+    -Wsuggest-attribute=format \
+    -Wsuggest-attribute=malloc \
+    -Wsuggest-attribute=noreturn \
+    -Wsuggest-attribute=pure \
+    -Wsuggest-final-methods \
+    -Wsuggest-final-types \
+    -Wswitch \
+    -Wswitch-bool \
+    -Wswitch-unreachable \
+    -Wsync-nand \
+    -Wsystem-headers \
+    -Wtautological-compare \
+    -Wtrampolines \
+    -Wtrigraphs \
+    -Wtype-limits \
+    -Wuninitialized \
+    -Wunknown-pragmas \
+    -Wunsafe-loop-optimizations \
+    -Wunused \
+    -Wunused-but-set-parameter \
+    -Wunused-but-set-variable \
+    -Wunused-function \
+    -Wunused-label \
+    -Wunused-local-typedefs \
+    -Wunused-macros \
+    -Wunused-parameter \
+    -Wunused-result \
+    -Wunused-value \
+    -Wunused-variable \
+    -Wvarargs \
+    -Wvariadic-macros \
+    -Wvector-operation-performance \
+    -Wvla \
+    -Wvolatile-register-var \
+    -Wwrite-strings \
+    \
+    ; do
+    gl_manywarn_set="$gl_manywarn_set $gl_manywarn_item"
+  done
+
+  # gcc --help=warnings outputs an unusual form for these options; list
+  # them here so that the above 'comm' command doesn't report a false match.
+  # Would prefer "min (PTRDIFF_MAX, SIZE_MAX)", but it must be a literal.
+  # Also, AC_COMPUTE_INT requires it to fit in a long; it is 2**63 on
+  # the only platforms where it does not fit in a long, so make that
+  # a special case.
+  AC_MSG_CHECKING([max safe object size])
+  AC_COMPUTE_INT([gl_alloc_max],
+    [LONG_MAX < (PTRDIFF_MAX < (size_t) -1 ? PTRDIFF_MAX : (size_t) -1)
+     ? -1
+     : PTRDIFF_MAX < (size_t) -1 ? (long) PTRDIFF_MAX : (long) (size_t) -1],
+    [[#include <limits.h>
+      #include <stddef.h>
+      #include <stdint.h>
+    ]],
+    [gl_alloc_max=2147483647])
+  case $gl_alloc_max in
+    -1) gl_alloc_max=9223372036854775807;;
+  esac
+  AC_MSG_RESULT([$gl_alloc_max])
+  gl_manywarn_set="$gl_manywarn_set -Walloc-size-larger-than=$gl_alloc_max"
+  gl_manywarn_set="$gl_manywarn_set -Warray-bounds=2"
+  gl_manywarn_set="$gl_manywarn_set -Wformat-overflow=2"
+  gl_manywarn_set="$gl_manywarn_set -Wformat-truncation=2"
+  gl_manywarn_set="$gl_manywarn_set -Wimplicit-fallthrough=5"
+  gl_manywarn_set="$gl_manywarn_set -Wnormalized=nfc"
+  gl_manywarn_set="$gl_manywarn_set -Wshift-overflow=2"
+  gl_manywarn_set="$gl_manywarn_set -Wstringop-overflow=2"
+  gl_manywarn_set="$gl_manywarn_set -Wunused-const-variable=2"
+  gl_manywarn_set="$gl_manywarn_set -Wvla-larger-than=4031"
+
+  # These are needed for older GCC versions.
+  if test -n "$GCC"; then
+    case `($CC --version) 2>/dev/null` in
+      'gcc (GCC) '[[0-3]].* | \
+      'gcc (GCC) '4.[[0-7]].*)
+        gl_manywarn_set="$gl_manywarn_set -fdiagnostics-show-option"
+        gl_manywarn_set="$gl_manywarn_set -funit-at-a-time"
+          ;;
+    esac
+  fi
+
+  # Disable specific options as needed.
+  if test "$gl_cv_cc_nomfi_needed" = yes; then
+    gl_manywarn_set="$gl_manywarn_set -Wno-missing-field-initializers"
+  fi
+
+  if test "$gl_cv_cc_uninitialized_supported" = no; then
+    gl_manywarn_set="$gl_manywarn_set -Wno-uninitialized"
+  fi
+
+  $1=$gl_manywarn_set
+
+  AC_LANG_POP([C])
+])
+
+# Specialization for _AC_LANG = C++.
+# Use of m4_defun rather than AC_DEFUN works around a bug in autoconf < 2.63b.
+m4_defun([gl_MANYWARN_ALL_GCC(C++)],
+[
+  gl_MANYWARN_ALL_GCC_CXX_IMPL([$1])
+])
index a32e5dc..8c58f9d 100644 (file)
@@ -1,6 +1,6 @@
 ## Process this file with automake to produce Makefile.in
 
-## Copyright (C) 2010-2019 Colin Watson.
+## Copyright (C) 2010-2020 Colin Watson.
 ##
 ## This file is part of libpipeline.
 ##
@@ -40,7 +40,7 @@ libpipeline_la_LIBADD = ../gl/lib/libgnu.la $(LTLIBOBJS)
 libpipeline_la_LDFLAGS = \
        -export-symbols-regex '^(pipecmd|pipeline)_' \
        -no-undefined \
-       -version-info 6:1:5
+       -version-info 6:2:5
 
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = libpipeline.pc
index 3671ae0..05480dd 100644 (file)
@@ -125,6 +125,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/pipeline-socketpair.m4 \
        $(top_srcdir)/gl/m4/ltversion.m4 \
        $(top_srcdir)/gl/m4/lt~obsolete.m4 \
        $(top_srcdir)/gl/m4/malloc.m4 $(top_srcdir)/gl/m4/malloca.m4 \
+       $(top_srcdir)/gl/m4/manywarnings.m4 \
        $(top_srcdir)/gl/m4/memchr.m4 $(top_srcdir)/gl/m4/mkdir.m4 \
        $(top_srcdir)/gl/m4/mkdtemp.m4 \
        $(top_srcdir)/gl/m4/mmap-anon.m4 \
@@ -1123,7 +1124,7 @@ libpipeline_la_LIBADD = ../gl/lib/libgnu.la $(LTLIBOBJS)
 libpipeline_la_LDFLAGS = \
        -export-symbols-regex '^(pipecmd|pipeline)_' \
        -no-undefined \
-       -version-info 6:1:5
+       -version-info 6:2:5
 
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = libpipeline.pc
index a02a541..944a2cd 100644 (file)
@@ -48,7 +48,8 @@ void init_debug (void)
                debug_level = 1;
 }
 
-static void vdebug (const char *message, va_list args)
+static void PIPELINE_ATTR_FORMAT_PRINTF (1, 0) vdebug (const char *message,
+                                                      va_list args)
 {
        if (debug_level)
                vfprintf (stderr, message, args);
index d55ffe3..cc8a428 100644 (file)
@@ -25,6 +25,6 @@ includedir=@includedir@
 Name: @PACKAGE_NAME@
 Description: Pipeline manipulation library
 Version: @PACKAGE_VERSION@
-URL: http://libpipeline.nongnu.org/
+URL: https://nongnu.org/libpipeline/
 Libs: -L${libdir} -lpipeline
 Cflags: -I${includedir}
index ee1cec4..31c1227 100644 (file)
@@ -371,7 +371,7 @@ pipecmd *pipecmd_new_sequence (const char *name, ...)
        return cmd;
 }
 
-static void passthrough (void *data PIPELINE_ATTR_UNUSED)
+static void passthrough (void *data _GL_UNUSED)
 {
        for (;;) {
                char buffer[4096];
@@ -535,7 +535,7 @@ void pipecmd_argstr (pipecmd *cmd, const char *argstr)
        }
 }
 
-int pipecmd_get_nargs (pipecmd *cmd)
+int _GL_ATTRIBUTE_PURE pipecmd_get_nargs (pipecmd *cmd)
 {
        struct pipecmd_process *cmdp;
 
@@ -820,7 +820,8 @@ void pipecmd_exec (pipecmd *cmd)
                                cmdf->free_func (cmdf->data);
                        if (cmd->pre_exec_free_func)
                                cmd->pre_exec_free_func (cmd->pre_exec_data);
-                       exit (0);
+                       fflush (NULL);
+                       _exit (0);
                }
 
                case PIPECMD_SEQUENCE: {
@@ -897,12 +898,12 @@ void pipecmd_exec (pipecmd *cmd)
 
                                if (WIFSIGNALED (status)) {
                                        raise (WTERMSIG (status));
-                                       exit (1); /* just to make sure */
+                                       _exit (1); /* just to make sure */
                                } else if (status && WIFEXITED (status))
-                                       exit (WEXITSTATUS (status));
+                                       _exit (WEXITSTATUS (status));
                        }
 
-                       exit (0);
+                       _exit (0);
                }
        }
 
@@ -910,7 +911,7 @@ void pipecmd_exec (pipecmd *cmd)
        /* Never called, but gcc doesn't realise that error with non-zero
         * status always exits.
         */
-       exit (EXEC_FAILED_EXIT_STATUS);
+       _exit (EXEC_FAILED_EXIT_STATUS);
 }
 
 void pipecmd_free (pipecmd *cmd)
@@ -1153,12 +1154,12 @@ void pipeline_commands (pipeline *p, ...)
        va_end (cmdv);
 }
 
-int pipeline_get_ncommands (pipeline *p)
+int _GL_ATTRIBUTE_PURE pipeline_get_ncommands (pipeline *p)
 {
        return p->ncommands;
 }
 
-pipecmd *pipeline_get_command (pipeline *p, int n)
+pipecmd * _GL_ATTRIBUTE_PURE pipeline_get_command (pipeline *p, int n)
 {
        if (n < 0 || n >= p->ncommands)
                return NULL;
@@ -1175,7 +1176,7 @@ pipecmd *pipeline_set_command (pipeline *p, int n, pipecmd *cmd)
        return prev;
 }
 
-pid_t pipeline_get_pid (pipeline *p, int n)
+pid_t _GL_ATTRIBUTE_PURE pipeline_get_pid (pipeline *p, int n)
 {
        assert (p->pids);       /* pipeline started */
        if (n < 0 || n >= p->ncommands)
@@ -2223,7 +2224,7 @@ const char *pipeline_peek (pipeline *p, size_t *len)
        return get_block (p, len, 1);
 }
 
-size_t pipeline_peek_size (pipeline *p)
+size_t _GL_ATTRIBUTE_PURE pipeline_peek_size (pipeline *p)
 {
        if (!p->buffer)
                return 0;
index bd49cbc..dd3d738 100644 (file)
@@ -50,6 +50,10 @@ extern "C" {
 #endif
 
 /* Does this compiler support marking variables as unused? */
+/* This is no longer used internally and isn't documented as part of
+ * libpipeline's public API, but is preserved just in case somebody used it
+ * anyway.
+ */
 #if PIPELINE_GNUC_PREREQ(2,4)
 #  define PIPELINE_ATTR_UNUSED __attribute__ ((__unused__))
 #else
@@ -380,8 +384,12 @@ typedef void pipeline_post_fork_fn (void);
  */
 void pipeline_install_post_fork (pipeline_post_fork_fn *fn);
 
-/* Start the processes in a pipeline. Installs this library's SIGCHLD
- * handler if not already installed. Calls error(FATAL) on error. */
+/* Start the processes in a pipeline.  Installs this library's SIGCHLD
+ * handler if not already installed.  Calls error(FATAL) on error.
+ *
+ * The standard file descriptors (0, 1, and 2) must be open before calling
+ * this function.
+ */
 void pipeline_start (pipeline *p);
 
 /* Wait for a pipeline to complete.  Set *statuses to a newly-allocated
index b1b6cb6..9730d40 100644 (file)
@@ -122,6 +122,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/pipeline-socketpair.m4 \
        $(top_srcdir)/gl/m4/ltversion.m4 \
        $(top_srcdir)/gl/m4/lt~obsolete.m4 \
        $(top_srcdir)/gl/m4/malloc.m4 $(top_srcdir)/gl/m4/malloca.m4 \
+       $(top_srcdir)/gl/m4/manywarnings.m4 \
        $(top_srcdir)/gl/m4/memchr.m4 $(top_srcdir)/gl/m4/mkdir.m4 \
        $(top_srcdir)/gl/m4/mkdtemp.m4 \
        $(top_srcdir)/gl/m4/mmap-anon.m4 \
index 9d95fda..cf19907 100644 (file)
@@ -547,6 +547,9 @@ Calls
 .Li error (FATAL)
 on error.
 .Pp
+The standard file descriptors (0, 1, and 2) must be open before calling this
+function.
+.Pp
 .It Xo
 .Ft int Fn pipeline_wait_all "pipeline *p" "int **statuses" "int *n_statuses"
 .Xc
index ba3ac6d..6a75fb3 100644 (file)
@@ -125,6 +125,7 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/pipeline-socketpair.m4 \
        $(top_srcdir)/gl/m4/ltversion.m4 \
        $(top_srcdir)/gl/m4/lt~obsolete.m4 \
        $(top_srcdir)/gl/m4/malloc.m4 $(top_srcdir)/gl/m4/malloca.m4 \
+       $(top_srcdir)/gl/m4/manywarnings.m4 \
        $(top_srcdir)/gl/m4/memchr.m4 $(top_srcdir)/gl/m4/mkdir.m4 \
        $(top_srcdir)/gl/m4/mkdtemp.m4 \
        $(top_srcdir)/gl/m4/mmap-anon.m4 \
index bc38fcc..4dd912a 100644 (file)
@@ -72,7 +72,7 @@ START_TEST (test_argstr_exec)
 }
 END_TEST
 
-Suite *argstr_suite (void)
+static Suite *argstr_suite (void)
 {
        Suite *s = suite_create ("Argstr");
 
index 3878bb1..245933c 100644 (file)
@@ -300,7 +300,7 @@ END_TEST
 /* This is of course better done using pipecmd_setenv, but setting an
  * environment variable makes for an easy test.
  */
-static void pre_exec (void *data PIPELINE_ATTR_UNUSED)
+static void pre_exec (void *data _GL_UNUSED)
 {
        setenv ("TEST1", "10", 1);
 }
@@ -338,7 +338,7 @@ START_TEST (test_basic_sequence)
 }
 END_TEST
 
-Suite *basic_suite (void)
+static Suite *basic_suite (void)
 {
        Suite *s = suite_create ("Basic");
 
index 7474fa9..0c04cb0 100644 (file)
@@ -20,8 +20,7 @@
        } while (0)
 
 #define MAIN(test) \
-       int main (int argc PIPELINE_ATTR_UNUSED, \
-                 char **argv PIPELINE_ATTR_UNUSED) \
+       int main (int argc _GL_UNUSED, char **argv _GL_UNUSED) \
        { \
                int failed; \
                Suite *s = test##_suite (); \
index 69fcbc8..00563b8 100644 (file)
@@ -123,7 +123,7 @@ START_TEST (test_exec_function)
 }
 END_TEST
 
-Suite *exec_suite (void)
+static Suite *exec_suite (void)
 {
        Suite *s = suite_create ("Exec");
 
index 587cf7f..2826475 100644 (file)
@@ -73,7 +73,7 @@ START_TEST (test_inspect_pipeline)
 }
 END_TEST
 
-static void pid_helper (void *data PIPELINE_ATTR_UNUSED)
+static void pid_helper (void *data _GL_UNUSED)
 {
        struct sigaction sa;
 
@@ -126,7 +126,7 @@ START_TEST (test_inspect_pid)
 }
 END_TEST
 
-Suite *inspect_suite (void)
+static Suite *inspect_suite (void)
 {
        Suite *s = suite_create ("Inspect");
 
index 98a6077..0cb7c3e 100644 (file)
@@ -70,7 +70,7 @@ START_TEST (test_pump_connect_attaches_correctly)
 }
 END_TEST
 
-static void tee_source (void *data PIPELINE_ATTR_UNUSED)
+static void tee_source (void *data _GL_UNUSED)
 {
        unsigned char buf[256];
        int i;
@@ -115,7 +115,7 @@ START_TEST (test_pump_tee)
 }
 END_TEST
 
-Suite *pump_suite (void)
+static Suite *pump_suite (void)
 {
        Suite *s = suite_create ("Pump");
 
index 886624b..79186d3 100644 (file)
@@ -146,7 +146,7 @@ START_TEST (test_read_readline_slow)
 }
 END_TEST
 
-Suite *read_suite (void)
+static Suite *read_suite (void)
 {
        Suite *s = suite_create ("Read");
 
index f53fde1..d01a462 100644 (file)
@@ -90,7 +90,7 @@ START_TEST (test_redirect_outfile)
 }
 END_TEST
 
-Suite *redirect_suite (void)
+static Suite *redirect_suite (void)
 {
        Suite *s = suite_create ("Redirect");