From: Stefano Lattarini Date: Mon, 20 Dec 2010 13:57:27 +0000 (+0100) Subject: Warnings win over strictness in AM_INIT_AUTOMAKE. X-Git-Tag: ng-0.5a~248^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9a88bf663b640f2960111b387ad572ee1aa3a7b7;p=thirdparty%2Fautomake.git 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. --- diff --git a/ChangeLog b/ChangeLog index 0db84ff3c..a25f4008e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,16 @@ 2011-01-15 Stefano Lattarini + For PR automake/547: + 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. + For PR automake/547: Warnings win over strictness on command line. Ensure that, on the command line at least, explicitly defined 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 or C. +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. + 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; } diff --git a/tests/warnings-win-over-strictness.test b/tests/warnings-win-over-strictness.test index 27936ecf2..eb0b3a7a9 100755 --- a/tests/warnings-win-over-strictness.test +++ b/tests/warnings-win-over-strictness.test @@ -35,6 +35,15 @@ ko () test `wc -l $2-t + mv -f $2-t $2 + set -x + cat $2 +} + # Files required in gnu strictness. touch README INSTALL NEWS AUTHORS ChangeLog COPYING @@ -49,4 +58,17 @@ ko -Wportability --foreign ok --gnu -Wno-portability ok -Wno-portability --gnu +rm -rf autom4te*.cache +set_am_opts 'foreign -Wportability' configure.in +ko +rm -rf autom4te*.cache +set_am_opts '-Wportability foreign' configure.in +ko +rm -rf autom4te*.cache +set_am_opts 'gnu -Wno-portability' configure.in +ok +rm -rf autom4te*.cache +set_am_opts '-Wno-portability gnu' configure.in +ok + :