From 1609491e95df66d8119ada02eeeb4070ca3a9a28 Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Mon, 20 Dec 2010 18:29:50 +0100 Subject: [PATCH] Warnings win over strictness in AUTOMAKE_OPTIONS. Ensure that, for what concerns the options specified in AUTOMAKE_OPTIONS, explicitly-defined warnings always take precedence over implicit strictness-implied warnings. This finally fixes Automake bug#7669 a.k.a. PR/547. * automake.in (handle_options): Call 'process_option_list' only once per set of options. * lib/Automake/Options.pm (process_global_option_list, process_option_list): Add sanity checks. ($_options_processed, $_global_options_processed): New internal variables, used by the sanity checks above. * tests/warnings-win-over-strictness.test: Extend. --- ChangeLog | 14 ++++++++++++++ automake.in | 11 ++++------- lib/Automake/Options.pm | 13 +++++++++++++ tests/warnings-win-over-strictness.test | 18 +++++++++++++++++- 4 files changed, 48 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6c65edf38..050ec979a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,19 @@ 2011-01-15 Stefano Lattarini + For PR automake/547: + Warnings win over strictness in AUTOMAKE_OPTIONS. + Ensure that, for what concerns the options specified in + AUTOMAKE_OPTIONS, explicitly-defined warnings always take + precedence over implicit strictness-implied warnings. + This finally fixes Automake bug#7669 a.k.a. PR/547. + * automake.in (handle_options): Call 'process_option_list' + only once per set of options. + * lib/Automake/Options.pm (process_global_option_list, + process_option_list): Add sanity checks. + ($_options_processed, $_global_options_processed): New + internal variables, used by the sanity checks above. + * tests/warnings-win-over-strictness.test: Extend. + For PR automake/547: Change signature of 'Automake::Options::_process_option_list()'. This only modifies internal details in the automake implementation, diff --git a/automake.in b/automake.in index 5d5af933d..ef3b8a65b 100644 --- a/automake.in +++ b/automake.in @@ -1244,13 +1244,10 @@ sub handle_options msg_var ('unsupported', $var, "`AUTOMAKE_OPTIONS' cannot have conditional contents"); } - foreach my $locvals ($var->value_as_list_recursive (cond_filter => TRUE, - location => 1)) - { - my ($where, $value) = @$locvals; - return 1 if process_option_list ({ option => $value, - where => $where}); - } + my @options = map { { option => $_->[1], where => $_->[0] } } + $var->value_as_list_recursive (cond_filter => TRUE, + location => 1); + return 1 if process_option_list (@options); } # Override portability-recursive warning. diff --git a/lib/Automake/Options.pm b/lib/Automake/Options.pm index 9f221784a..31052c070 100644 --- a/lib/Automake/Options.pm +++ b/lib/Automake/Options.pm @@ -76,6 +76,12 @@ Fs. use vars '%_options'; # From AUTOMAKE_OPTIONS use vars '%_global_options'; # from AM_INIT_AUTOMAKE or the command line. +# Whether process_option_list has already been called for the current +# Makefile.am. +use vars '$_options_processed'; +# Whether process_global_option_list has already been called. +use vars '$_global_options_processed'; + =head2 Constants =over 4 @@ -135,6 +141,7 @@ previous F. sub reset () { + $_options_processed = 0; %_options = %_global_options; # The first time we are run, # remember the current setting as the default. @@ -347,12 +354,18 @@ sub _process_option_list (\%@) sub process_option_list (@) { + prog_error "local options already processed" + if $_options_processed; return _process_option_list (%_options, @_); + $_options_processed = 1; } sub process_global_option_list (@) { + prog_error "global options already processed" + if $_global_options_processed; return _process_option_list (%_global_options, @_); + $_global_options_processed = 1; } =item C diff --git a/tests/warnings-win-over-strictness.test b/tests/warnings-win-over-strictness.test index eb0b3a7a9..0db3176a4 100755 --- a/tests/warnings-win-over-strictness.test +++ b/tests/warnings-win-over-strictness.test @@ -38,7 +38,8 @@ ko () set_am_opts() { set +x - sed -e "s|^\\(AM_INIT_AUTOMAKE\\).*|\\1([$1])|" <$2 >$2-t + sed <$2 >$2-t -e "s|^\\(AUTOMAKE_OPTIONS\\) *=.*|\\1 = $1|" \ + -e "s|^\\(AM_INIT_AUTOMAKE\\).*|\\1([$1])|" mv -f $2-t $2 set -x cat $2 @@ -48,6 +49,7 @@ set_am_opts() touch README INSTALL NEWS AUTHORS ChangeLog COPYING cat > Makefile.am <