diff options
author | Stefano Lattarini <stefano.lattarini@gmail.com> | 2010-12-20 14:57:27 +0100 |
---|---|---|
committer | Stefano Lattarini <stefano.lattarini@gmail.com> | 2011-01-15 15:25:23 +0100 |
commit | 9a88bf663b640f2960111b387ad572ee1aa3a7b7 (patch) | |
tree | c940d2385068621d7f2e99c1926673a09c96188e /lib/Automake/Options.pm | |
parent | b67240eb097e5b1ef2b76492e07dc706ee5103bd (diff) | |
download | automake-9a88bf663b640f2960111b387ad572ee1aa3a7b7.tar.gz |
Warnings win over strictness in AM_INIT_AUTOMAKE.
This change ensures that, for what concerns the options specified
in AM_INIT_AUTOMAKE, explicitly-defined warnings always take
precedence over implicit strictness-implied warnings. Related to
Automake bug#7669 a.k.a. PR/547.
* lib/Automake/Options.pm (_process_option_list): Parse explicit
warnings only after the strictness level has been set. Fix POD
documentation.
* tests/warnings-win-over-strictness.test: Extend.
Diffstat (limited to 'lib/Automake/Options.pm')
-rw-r--r-- | lib/Automake/Options.pm | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/lib/Automake/Options.pm b/lib/Automake/Options.pm index a6d65a8eb..a3607c3f7 100644 --- a/lib/Automake/Options.pm +++ b/lib/Automake/Options.pm @@ -229,6 +229,10 @@ sub unset_global_option ($) 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>. +These functions should be called at most once for each set of options +having the same precedence; i.e., do not call it twice for two options +from C<AM_INIT_AUTOMAKE>. + Return 1 on error, 0 otherwise. =cut @@ -242,6 +246,7 @@ Return 1 on error, 0 otherwise. sub _process_option_list (\%$@) { my ($options, $where, @list) = @_; + my @warnings = (); foreach (@list) { @@ -313,11 +318,7 @@ sub _process_option_list (\%$@) } elsif (/^(?:--warnings=|-W)(.*)$/) { - foreach my $cat (split (',', $1)) - { - msg 'unsupported', $where, "unknown warning category `$cat'" - if switch_warning $cat; - } + push @warnings, split (',', $1); } else { @@ -326,6 +327,14 @@ sub _process_option_list (\%$@) return 1; } } + # 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) + { + msg 'unsupported', $where, "unknown warning category `$cat'" + if switch_warning $cat; + } return 0; } |