From: Ralf Wildenhues Date: Sun, 11 Oct 2009 11:33:43 +0000 (+0200) Subject: Allow variable override of, rather than by, silent variables. X-Git-Tag: v1.11.1~8^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c2594bb50eb2c6f668513af07f8efafd17f37b0e;p=thirdparty%2Fautomake.git Allow variable override of, rather than by, silent variables. When overriding variables, check the VAR_SILENT status of the old condition, not the new one: we allow non-silent overrides of silent variables (these do not hit ordering bugs in the automake output), but there is no use case for doing so the other way round. Fixes conditional overrides of variables annotated AM_SUBST_NOTMAKE in configure.ac. * lib/Automake/Variable.pm (_check_ambiguous_condition): Check for VAR_SILENT in $ambig_cond not $cond. * tests/cond44.test, tests/cond45.test: New tests, analogous to cond23.test and cond24.test. * tests/Makefile.am: Update. Spotted originally in binutils/bfd. Signed-off-by: Ralf Wildenhues --- diff --git a/ChangeLog b/ChangeLog index 6d1bf3a02..2d3a261a4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,19 @@ 2009-10-11 Ralf Wildenhues + Allow variable override of, rather than by, silent variables. + When overriding variables, check the VAR_SILENT status of the + old condition, not the new one: we allow non-silent overrides + of silent variables (these do not hit ordering bugs in the + automake output), but there is no use case for doing so the + other way round. Fixes conditional overrides of variables + annotated AM_SUBST_NOTMAKE in configure.ac. + * lib/Automake/Variable.pm (_check_ambiguous_condition): Check + for VAR_SILENT in $ambig_cond not $cond. + * tests/cond44.test, tests/cond45.test: New tests, analogous to + cond23.test and cond24.test. + * tests/Makefile.am: Update. + Spotted originally in binutils/bfd. + Fix `make clean check' for the Automake package. * lib/Automake/Makefile.am (SUBDIRS): Add `.' before `tests', so that Config.pm is built first. diff --git a/lib/Automake/Makefile.in b/lib/Automake/Makefile.in index d3192d9ee..ea5da72ff 100644 --- a/lib/Automake/Makefile.in +++ b/lib/Automake/Makefile.in @@ -206,7 +206,9 @@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ -SUBDIRS = tests + +# `make clean check' should build Config.pm first. +SUBDIRS = . tests perllibdir = $(pkgvdatadir)/Automake dist_perllib_DATA = \ ChannelDefs.pm \ diff --git a/lib/Automake/Variable.pm b/lib/Automake/Variable.pm index 1e24bb2ba..f0c867f65 100644 --- a/lib/Automake/Variable.pm +++ b/lib/Automake/Variable.pm @@ -466,8 +466,9 @@ sub _check_ambiguous_condition ($$$) my $var = $self->name; my ($message, $ambig_cond) = $self->conditions->ambiguous_p ($var, $cond); - # We allow silent variables to be overridden silently. - my $def = $self->def ($cond); + # We allow silent variables to be overridden silently, + # by either silent or non-silent variables. + my $def = $self->def ($ambig_cond); if ($message && !($def && $def->pretty == VAR_SILENT)) { msg 'syntax', $where, "$message ...", partial => 1; diff --git a/tests/Makefile.am b/tests/Makefile.am index 3d52ba8fb..98829c9ac 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -185,6 +185,8 @@ cond40.test \ cond41.test \ cond42.test \ cond43.test \ +cond44.test \ +cond45.test \ condd.test \ condhook.test \ condinc.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index ddd8d7139..d12b8504d 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -419,6 +419,8 @@ cond40.test \ cond41.test \ cond42.test \ cond43.test \ +cond44.test \ +cond45.test \ condd.test \ condhook.test \ condinc.test \ diff --git a/tests/cond44.test b/tests/cond44.test new file mode 100755 index 000000000..ac907f171 --- /dev/null +++ b/tests/cond44.test @@ -0,0 +1,40 @@ +#!/bin/sh +# Copyright (C) 2002, 2003, 2009 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 2, 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 . + +# Check that redefinitions of AC_SUBST'ed AM_SUBST_NOTMAKE'd variables +# are not diagnosed. See cond23.test. + +. ./defs + +set -e + +cat >>configure.in <Makefile.am <>configure.in <Makefile.am <