]> git.ipfire.org Git - thirdparty/autoconf.git/commitdiff
Disable all warnings when running autoconf as a subprocess.
authorZack Weinberg <zackw@panix.com>
Mon, 21 Sep 2020 20:59:46 +0000 (16:59 -0400)
committerZack Weinberg <zackw@panix.com>
Tue, 22 Sep 2020 19:46:43 +0000 (15:46 -0400)
autoheader and autoscan both run autoconf in trace mode, and
autoheader makes a point of passing down the warnings options.
This means autoheader prints warnings that a regular invocation
of autoconf would also print, so in the common case where both
are being run by autoreconf, the warnings are duplicated.
autoscan doesn’t pass down warnings options but it _does_ leave
the WARNINGS environment variable alone, which means it may issue
completely spurious warnings because the configure script is still
under construction.

Change this so that both programs disable all warnings for the
subsidiary invocation of autoconf, by not passing any warnings
options themselves, and by setting the WARNINGS environment variable
to “none” for the subprocess.  For this to work correctly, the
‘args: --warnings syntax’ line has to be removed from autom4te.cfg
(m4sugar section).  Since syntax warnings are on by default anyway,
the sole effect of this is to allow WARNINGS=none to turn off syntax
warnings.

The test suite changes are all to remove expectations of duplicate
diagnostics from autoheader.

* bin/autoheader.in: Do not pass warnings options down to subsidiary
  autoconf, and set WARNINGS=none in the environment for that process.
* bin/autoscan.in: Set WARNINGS=none in the environment for subsidiary
  autoconf.
* lib/autom4te.in (M4sugar): Remove ‘--warnings syntax’.
* tests/semantics.at, tests/torture.at: No longer expect various
  diagnostics from autoheader as well as autoconf.

bin/autoheader.in
bin/autoscan.in
lib/autom4te.in
tests/semantics.at
tests/torture.at

index 6b02cbb8e59b9b3d5ee2d2d1c9d8196e668babde..1f3af9f10afddc732e45882495fdaf90a099cd3e 100644 (file)
@@ -166,7 +166,6 @@ END
 my $autoconf = "'$autom4te' --language=autoconf ";
 $autoconf .= join (' --include=', '', map { shell_quote ($_) } @include);
 $autoconf .= join (' --prepend-include=', '', map { shell_quote ($_) } @prepend_include);
-$autoconf .= join (' --warnings=', '', map { shell_quote ($_) } @warnings);
 $autoconf .= ' --debug' if $debug;
 $autoconf .= ' --force' if $force;
 $autoconf .= ' --verbose' if $verbose;
@@ -178,13 +177,17 @@ $autoconf .= ' --verbose' if $verbose;
 # Source what the traces are trying to tell us.
 verb "$me: running $autoconf to trace from $ARGV[0]";
 my $quoted_tmp = shell_quote ($tmp);
-xsystem ("$autoconf"
-        # If you change this list, update the
-        # 'Autoheader-preselections' section of autom4te.in.
-        . ' --trace AC_CONFIG_HEADERS:\'$$config_h ||= \'"\'"\'$1\'"\'"\';\''
-        . ' --trace AH_OUTPUT:\'$$verbatim{\'"\'"\'$1\'"\'"\'} = \'"\'"\'$2\'"\'"\';\''
-        . ' --trace AC_DEFINE_TRACE_LITERAL:\'$$symbol{\'"\'"\'$1\'"\'"\'} = 1;\''
-        . " " . shell_quote ($ARGV[0]) . " >$quoted_tmp/traces.pl");
+{
+  # Suppress all warnings from the subsidiary autoconf invocation.
+  local $ENV{WARNINGS} = 'none';
+  xsystem ("$autoconf"
+           # If you change this list, update the
+           # 'Autoheader-preselections' section of autom4te.in.
+           . ' --trace AC_CONFIG_HEADERS:\'$$config_h ||= \'"\'"\'$1\'"\'"\';\''
+           . ' --trace AH_OUTPUT:\'$$verbatim{\'"\'"\'$1\'"\'"\'} = \'"\'"\'$2\'"\'"\';\''
+           . ' --trace AC_DEFINE_TRACE_LITERAL:\'$$symbol{\'"\'"\'$1\'"\'"\'} = 1;\''
+           . " " . shell_quote ($ARGV[0]) . " >$quoted_tmp/traces.pl");
+}
 
 local (%verbatim, %symbol);
 debug "$me: 'do'ing $tmp/traces.pl:\n" . `sed 's/^/| /' $quoted_tmp/traces.pl`;
index 99df49291c1243857f17b59320993c0f0c8f2fec..658a79807cbea9f791b2441fb08e8bdbaacaf39b 100644 (file)
@@ -591,7 +591,10 @@ sub check_configure_ac ($)
     join (' --trace=', '',
          uniq (sort (map { s/\(.*//; $_ } keys %needed_macros)));
 
-  verb "running: $autoconf $trace_option $configure_ac";
+  # Suppress all warnings from the subsidiary autoconf invocation.
+  local $ENV{WARNINGS} = 'none';
+
+  verb "running: WARNINGS=none $autoconf $trace_option $configure_ac";
   my $traces =
     new Autom4te::XFile "$autoconf $trace_option $configure_ac |";
 
index 3c787972a8a93e1ac5725c2effd3c2177e084dc6..4f1f47994f732422814c82355ba71907aa8558c6 100644 (file)
@@ -169,5 +169,4 @@ end-language: "M4sh"
 begin-language: "M4sugar"
 args: --prepend-include '@pkgdatadir@'
 args: m4sugar/m4sugar.m4f
-args: --warnings syntax
 end-language: "M4sugar"
index e7dd7c5a7e5c745d997e7ad46f3dddf20c4b43fd..ab3cea7cb2235f179d76b8363bf399c589dca682 100644 (file)
@@ -214,11 +214,7 @@ AT_CHECK_AUTOHEADER([], [
   HAVE_FOPEN
   HAVE_FPRINTF
   HAVE_PRINTF
-], [], [],
-[[configure.ac:9: warning: AC_REPLACE_FUNCS($funcs): you should use literals
-functions.m4: AC_REPLACE_FUNCS is expanded from...
-configure.ac:9: the top level
-]])
+])
 AT_CHECK_CONFIGURE
 AT_CHECK_ENV
 AT_CHECK_DEFINES(
@@ -873,10 +869,6 @@ AT_CHECK_AUTOHEADER([-W no-obsolete], [
   HAVE_FN_FOO
   HAVE_FN_NOCOMMENT
   HAVE_FN_QUUX
-], [], [],
-[configure.ac:8: warning: $1($fns): you should use literals
-functions.m4: $1 is expanded from...
-configure.ac:8: the top level
 ])
 AT_CHECK_CONFIGURE
 AT_CLEANUP
@@ -956,10 +948,6 @@ AT_CHECK_AUTOHEADER([-W no-obsolete], [
   HAVE_SYS_TYPES_H
   HAVE_UNISTD_H
   STDC_HEADERS
-], [], [],
-[configure.ac:8: warning: $1($hs): you should use literals
-headers.m4: $1 is expanded from...
-configure.ac:8: the top level
 ])
 AT_CHECK_CONFIGURE
 AT_CLEANUP
index 5c61027c25d3bf4aa67bd75c50f9d0dd2f6b5c85..82706d347f028fe963fb9d0310847f6097e95155 100644 (file)
@@ -1071,11 +1071,7 @@ AT_CHECK([[sed '/trailer\.m4:/d; s/^configure\.ac:[45]: //' stderr]], [],
 [[warning: AC_DEFINE: `one
 two' is not a valid preprocessor define value
 ]])
-AT_CHECK_AUTOHEADER([], [foo], [], [], [stderr])
-AT_CHECK([[sed 's/^configure\.ac:[45]: //' stderr]], [],
-[[warning: AC_DEFINE: `one
-two' is not a valid preprocessor define value
-]])
+AT_CHECK_AUTOHEADER([], [foo])
 AT_CHECK_CONFIGURE
 AT_CHECK_DEFINES([[#define foo one
 ]])
@@ -1090,11 +1086,7 @@ AT_CHECK([[sed '/trailer.m4:/d; s/^configure\.ac:[45]: //' stderr]], [],
 [[warning: AC_DEFINE_UNQUOTED: `one
 two' is not a valid preprocessor define value
 ]])
-AT_CHECK_AUTOHEADER([], [foo], [], [], [stderr])
-AT_CHECK([[sed 's/^configure\.ac:[45]: //' stderr]], [],
-[[warning: AC_DEFINE_UNQUOTED: `one
-two' is not a valid preprocessor define value
-]])
+AT_CHECK_AUTOHEADER([], [foo])
 AT_CHECK_CONFIGURE
 AT_CHECK_DEFINES([[#define foo one
 ]])