[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[automake-commit] 02/03: Use WARNINGS=none to suppress warnings from aut
From: |
Zack Weinberg |
Subject: |
[automake-commit] 02/03: Use WARNINGS=none to suppress warnings from autom4te runs. |
Date: |
Thu, 24 Sep 2020 08:53:26 -0400 |
zackw pushed a commit to branch master
in repository automake.
View the commit online:
https://git.savannah.gnu.org/gitweb/?p=automake.git;a=commitdiff;h=bd09c76a76288998ce5f804bffca3c690232d1c8
commit bd09c76a76288998ce5f804bffca3c690232d1c8
Author: Zack Weinberg <zackw@panix.com>
AuthorDate: Fri Sep 18 13:40:20 2020 -0400
Use WARNINGS=none to suppress warnings from autom4te runs.
aclocal uses autom4te in trace mode to scan configure.ac for macros whose
definition is not yet available. It has a kludge to prevent this from
producing spurious warnings, but a cleaner, fully backward compatible, way
to
get the same effect is to set WARNINGS=none in the environment and not pass
down any -W options. (This is better than passing -Wnone on the command
line
because it automatically inherits to any subprocesses started by autom4te.)
Perl’s ‘local’ feature can be used to make the enviironment variable setting
temporary, reverting to the previous value when we exit the function.
automake also runs autom4te (technically autoconf) in trace mode; warnings
from this invocation will not be *spurious*, but in the common case where
the person running automake is going to run autoconf next, they will be
duplicated. Therefore, make the same change to automake.
* bin/aclocal.in (trace_used_macros)
* bin/automake.in (scan_autoconf_traces):
Use “local $ENV{WARNINGS}='none'” to suppress warnings from autom4te.
---
bin/aclocal.in | 19 ++++++++-----------
bin/automake.in | 7 ++++++-
2 files changed, 14 insertions(+), 12 deletions(-)
diff --git a/bin/aclocal.in b/bin/aclocal.in
index 42e8d83..ca2f963 100644
--- a/bin/aclocal.in
+++ b/bin/aclocal.in
@@ -762,22 +762,19 @@ sub trace_used_macros ()
my %files = map { $map{$_} => 1 } keys %macro_seen;
%files = strip_redundant_includes %files;
- # When AC_CONFIG_MACRO_DIRS is used, avoid possible spurious warnings
- # from autom4te about macros being "m4_require'd but not m4_defun'd";
- # for more background, see:
- # https://lists.gnu.org/archive/html/autoconf-patches/2012-11/msg00004.html
- # as well as autoconf commit 'v2.69-44-g1ed0548', "warn: allow aclocal
- # to silence m4_require warnings".
- my $early_m4_code .= "m4_define([m4_require_silent_probe], [-])";
+ # Suppress all warnings from this invocation of autom4te.
+ # In particular we want to avoid spurious warnings about
+ # macros being "m4_require'd but not m4_defun'd" because
+ # aclocal.m4 is not yet available.
+ local $ENV{WARNINGS} = 'none';
my $traces = ($ENV{AUTOM4TE} || '@am_AUTOM4TE@');
$traces .= " --language Autoconf-without-aclocal-m4 ";
- $traces = "echo '$early_m4_code' | $traces - ";
# Support AC_CONFIG_MACRO_DIRS also with older autoconf.
# Note that we can't use '$ac_config_macro_dirs_fallback' here, because
- # a bug in option parsing code of autom4te 2.68 and earlier will cause
- # it to read standard input last, even if the "-" argument is specified
+ # a bug in option parsing code of autom4te 2.68 and earlier would cause
+ # it to read standard input last, even if the "-" argument was specified
# early.
# FIXME: To be removed in Automake 2.0, once we can assume autoconf
# 2.70 or later.
@@ -807,7 +804,7 @@ sub trace_used_macros ()
# characters (like newlines).
(map { "--trace='$_:\$f::\$n'" } (keys %macro_seen)));
- verb "running $traces $configure_ac";
+ verb "running WARNINGS=$ENV{WARNINGS} $traces $configure_ac";
my $tracefh = new Automake::XFile ("$traces $configure_ac |");
diff --git a/bin/automake.in b/bin/automake.in
index 67b7290..a88b835 100644
--- a/bin/automake.in
+++ b/bin/automake.in
@@ -5249,6 +5249,11 @@ sub scan_autoconf_traces
sinclude => 1,
);
+ # Suppress all warnings from this invocation of autoconf.
+ # The user is presumably about to run autoconf themselves
+ # and will see its warnings then.
+ local $ENV{WARNINGS} = 'none';
+
my $traces = ($ENV{AUTOCONF} || '@am_AUTOCONF@') . " ";
# Use a separator unlikely to be used, not ':', the default, which
@@ -5257,8 +5262,8 @@ sub scan_autoconf_traces
map { "--trace=$_" . ':\$f:\$l::\$d::\$n::\${::}%' }
(keys %traced));
+ verb "running WARNINGS=$ENV{WARNINGS} $traces";
my $tracefh = new Automake::XFile ("$traces $filename |");
- verb "reading $traces";
@cond_stack = ();
my $where;