This is derived from [PATCH 09/10] of the older series. It requires a review.
Thanks, Stefano -*-*- 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 accepts 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. (process_option_list, process_global_option_list): Update. * automake.in (handle_options, scan_autoconf_traces): Update. --- ChangeLog | 13 ++++++++++++ automake.in | 11 +++++---- lib/Automake/Options.pm | 48 +++++++++++++++++++++++++--------------------- 3 files changed, 45 insertions(+), 27 deletions(-)
From 9e32b01ff19473684e8fb3a2aeb4852bce99d007 Mon Sep 17 00:00:00 2001 From: Stefano Lattarini <stefano.lattar...@gmail.com> Date: Mon, 20 Dec 2010 16:59:08 +0100 Subject: [PATCH 6/9] 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 accepts 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. (process_option_list, process_global_option_list): Update. * automake.in (handle_options, scan_autoconf_traces): Update. --- ChangeLog | 13 ++++++++++++ automake.in | 11 +++++---- lib/Automake/Options.pm | 48 +++++++++++++++++++++++++--------------------- 3 files changed, 45 insertions(+), 27 deletions(-) diff --git a/ChangeLog b/ChangeLog index dd08207..edafbfd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,18 @@ 2011-01-02 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 accepts 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. + (process_option_list, process_global_option_list): Updated. + * automake.in (handle_options, scan_autoconf_traces): Update. + +2011-01-02 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), add some more tests on diff --git a/automake.in b/automake.in index f464983..b05a1bd 100644 --- a/automake.in +++ b/automake.in @@ -1249,8 +1249,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}); } } @@ -5470,9 +5471,9 @@ sub scan_autoconf_traces ($) } elsif (defined $args[1]) { - exit $exit_code - if (process_global_option_list ($where, - split (' ', $args[1]))); + my @opts = split (' ', $args[1]); + @opts = map { { option => $_, where => $where } } @opts; + exit $exit_code if process_global_option_list (@opts); } } elsif ($macro eq 'AM_MAINTAINER_MODE') diff --git a/lib/Automake/Options.pm b/lib/Automake/Options.pm index 42ec0fd..9140424 100644 --- a/lib/Automake/Options.pm +++ b/lib/Automake/Options.pm @@ -222,30 +222,35 @@ sub unset_global_option ($) } -=item C<process_option_list ($where, @options)> +=item C<process_option_list (@options)> -=item C<process_global_option_list ($where, @options)> +=item C<process_global_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>. +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 # $BOOL -# _process_option_list (\%OPTIONS, $WHERE, @OPTIONS) -# -------------------------------------------------- -# Process a list of options. Return 1 on error, 0 otherwise. -# \%OPTIONS is the hash to fill with options data, $WHERE is -# the location where @OPTIONS occurred. -sub _process_option_list (\%$@) +# _process_option_list (\%OPTIONS, @OPTIONS) +# ------------------------------------------ +# Process a list of options. \%OPTIONS is the hash to fill with +# options data. +# options as get passed to public subroutines process_option_list() and +# process_global_option_list(). +sub _process_option_list (\%@) { - my ($options, $where, @list) = @_; + my ($options, @list) = @_; my @warnings = (); - foreach (@list) + foreach my $h (@list) { + my $_ = $h->{option}; + my $where = $h->{where}; $options->{$_} = $where; if ($_ eq 'gnits' || $_ eq 'gnu' || $_ eq 'foreign') { @@ -314,7 +319,8 @@ sub _process_option_list (\%$@) } elsif (/^(?:--warnings=|-W)(.*)$/) { - push @warnings, split (',', $1); + my @w = map { { cat => $_, loc => $where} } split (',', $1); + push @warnings, @w; } else { @@ -326,24 +332,22 @@ 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; } -sub process_option_list ($@) +sub process_option_list (@) { - my ($where, @list) = @_; - return _process_option_list (%_options, $where, @list); + return _process_option_list (%_options, @_); } -sub process_global_option_list ($@) +sub process_global_option_list (@) { - my ($where, @list) = @_; - return _process_option_list (%_global_options, $where, @list); + return _process_option_list (%_global_options, @_); } =item C<set_strictness ($name)> -- 1.7.2.3