From: Stefano Lattarini <stefano.lattar...@gmail.com> This only modifies internal details in the automake implementation, bearing no externally visible effect, but preparing the way for the final fix of Automake bug#7669 a.k.a. PR/547.
* lib/Automake/Options.pm (process_option_list): Now accept takes as arguments a list of hash references with keys 'option' and 'where', where 'option' is an option as might occur in AUTOMAKE_OPTIONS or M_INIT_AUTOMAKE, and 'where' is the location where that occurred. * automake.in (handle_options, scan_autoconf_traces): Update. --- ChangeLog | 12 ++++++++++++ automake.in | 9 +++++---- lib/Automake/Options.pm | 25 ++++++++++++++----------- 3 files changed, 31 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index 67e7be0..dd31019 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,17 @@ 2010-12-20 Stefano Lattarini <stefano.lattar...@gmail.com> + Change signature of 'Automake::Options::process_option_list()'. + This only modifies internal details in the automake implementation, + bearing no externally visible effect, but preparing the way for the + final fix of Automake bug#7669 a.k.a. PR/547. + * lib/Automake/Options.pm (process_option_list): Now accept takes as + arguments a list of hash references with keys 'option' and 'where', + where 'option' is an option as might occur in AUTOMAKE_OPTIONS or + M_INIT_AUTOMAKE, and 'where' is the location where that occurred. + * automake.in (handle_options, scan_autoconf_traces): Update. + +2010-12-20 Stefano Lattarini <stefano.lattar...@gmail.com> + Add more tests about AUTOMAKE_OPTIONS. In view of soon-to-follow refactorings (still in the pursuit of a fix for Automake bug#7669 a.k.a. PR/547), we add some more tests diff --git a/automake.in b/automake.in index d320ebd..9fd018c 100644 --- a/automake.in +++ b/automake.in @@ -1252,8 +1252,9 @@ sub handle_options foreach my $locvals ($var->value_as_list_recursive (cond_filter => TRUE, location => 1)) { - my ($loc, $value) = @$locvals; - return 1 if (process_option_list ($loc, $value)) + my ($where, $value) = @$locvals; + return 1 if process_option_list ({ option => $value, + where => $where}); } } @@ -5471,8 +5472,8 @@ sub scan_autoconf_traces ($) $am_remake_options{ignore_deps} = 1 if $opt eq 'no-dependencies'; } - exit $exit_code - if (process_option_list ($where, @opts)); + @opts = map { { option => $_, where => $where } } @opts; + exit $exit_code if process_option_list (@opts); } } elsif ($macro eq 'AM_MAINTAINER_MODE') diff --git a/lib/Automake/Options.pm b/lib/Automake/Options.pm index 5728895..5091c24 100644 --- a/lib/Automake/Options.pm +++ b/lib/Automake/Options.pm @@ -178,23 +178,25 @@ sub unset_option ($) delete $_options{$name}; } -=item C<process_option_list ($where, @options)> +=item C<process_option_list (@options)> -Process Automake's option lists. C<@options> should be a list of -words, as they occur in C<AUTOMAKE_OPTIONS> or C<AM_INIT_AUTOMAKE>. -C<$where> is the location where @OPTIONS occurred. +Process Automake's option lists. C<@options> should be a list of hash +references with keys C<option> and C<where>, where C<option> is an option +as might occur in C<AUTOMAKE_OPTIONS> or C<AM_INIT_AUTOMAKE>, and +C<where> is the location where that option occurred. Return 1 on error, 0 otherwise. =cut -sub process_option_list ($@) +sub process_option_list (@) { - my ($where, @list) = @_; my @warnings = (); - foreach (@list) + foreach my $h (@_) { + my $_ = $h->{option}; + my $where = $h->{where}; $_options{$_} = $where; if ($_ eq 'gnits' || $_ eq 'gnu' || $_ eq 'foreign') { @@ -263,7 +265,8 @@ sub process_option_list ($@) } elsif (/^(?:--warnings=|-W)(.*)$/) { - push @warnings, split (',', $1); + my @w = map { { cat => $_, loc => $where} } split (',', $1); + push @warnings, @w; } else { @@ -275,10 +278,10 @@ sub process_option_list ($@) # We process warnings here, so that any explicitly-given warning setting # will take precedence over warning settings defined implicitly by the # strictness. - foreach my $cat (@warnings) + foreach my $w (@warnings) { - msg 'unsupported', $where, "unknown warning category `$cat'" - if switch_warning $cat; + msg 'unsupported', $w->{loc}, "unknown warning category `$w->{cat}'" + if switch_warning $w->{cat}; } return 0; } -- 1.7.2.3