autoconf-patches
[Top][All Lists]
Advanced

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

[RFC PATCH 3/6] Disable all warnings when running autoconf as a subproce


From: Zack Weinberg
Subject: [RFC PATCH 3/6] Disable all warnings when running autoconf as a subprocess.
Date: Tue, 22 Sep 2020 16:04:52 -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  | 19 +++++++++++--------
 bin/autoscan.in    |  5 ++++-
 lib/autom4te.in    |  1 -
 tests/semantics.at | 14 +-------------
 tests/torture.at   | 12 ++----------
 5 files changed, 18 insertions(+), 33 deletions(-)

diff --git a/bin/autoheader.in b/bin/autoheader.in
index 6b02cbb8..1f3af9f1 100644
--- a/bin/autoheader.in
+++ b/bin/autoheader.in
@@ -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`;
diff --git a/bin/autoscan.in b/bin/autoscan.in
index 99df4929..658a7980 100644
--- a/bin/autoscan.in
+++ b/bin/autoscan.in
@@ -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 |";
 
diff --git a/lib/autom4te.in b/lib/autom4te.in
index 3c787972..4f1f4799 100644
--- a/lib/autom4te.in
+++ b/lib/autom4te.in
@@ -169,5 +169,4 @@ end-language: "M4sh"
 begin-language: "M4sugar"
 args: --prepend-include '@pkgdatadir@'
 args: m4sugar/m4sugar.m4f
-args: --warnings syntax
 end-language: "M4sugar"
diff --git a/tests/semantics.at b/tests/semantics.at
index e7dd7c5a..ab3cea7c 100644
--- a/tests/semantics.at
+++ b/tests/semantics.at
@@ -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
diff --git a/tests/torture.at b/tests/torture.at
index 5c61027c..82706d34 100644
--- a/tests/torture.at
+++ b/tests/torture.at
@@ -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
 ]])
-- 
2.28.0




reply via email to

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