This is derived from [PATCH 07/10] of the older series. It requires a review.
Thanks, Stefano -*-*- 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. * tests/warnings-win-over-strictness.test: Extend. --- ChangeLog | 12 ++++++++++++ lib/Automake/Options.pm | 15 ++++++++++----- tests/warnings-win-over-strictness.test | 22 ++++++++++++++++++++++ 3 files changed, 44 insertions(+), 5 deletions(-)
From 2a8950bdf9c3e34e308ff6d1bed2646af8ab87fe Mon Sep 17 00:00:00 2001 From: Stefano Lattarini <stefano.lattar...@gmail.com> Date: Mon, 20 Dec 2010 14:57:27 +0100 Subject: [PATCH 4/9] 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. * tests/warnings-win-over-strictness.test: Extend. --- ChangeLog | 12 ++++++++++++ lib/Automake/Options.pm | 15 ++++++++++----- tests/warnings-win-over-strictness.test | 22 ++++++++++++++++++++++ 3 files changed, 44 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index d2dd6a2..44ea412 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,18 @@ 2011-01-02 Stefano Lattarini <stefano.lattar...@gmail.com> 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. + * tests/warnings-win-over-strictness.test: Extend. + +2011-01-02 Stefano Lattarini <stefano.lattar...@gmail.com> + + For PR automake/547: Warnings win over strictness on command line. Ensure that, on the command line at least, explicitly defined warnings always take precedence over implicit strictness-implied diff --git a/lib/Automake/Options.pm b/lib/Automake/Options.pm index a6d65a8..42ec0fd 100644 --- a/lib/Automake/Options.pm +++ b/lib/Automake/Options.pm @@ -242,6 +242,7 @@ Return 1 on error, 0 otherwise. sub _process_option_list (\%$@) { my ($options, $where, @list) = @_; + my @warnings = (); foreach (@list) { @@ -313,11 +314,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 +323,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 ef42c4f..53de473 100755 --- a/tests/warnings-win-over-strictness.test +++ b/tests/warnings-win-over-strictness.test @@ -37,6 +37,15 @@ ko () test `wc -l <stderr` -eq 1 } +set_am_opts() +{ + set +x + sed -e "s|^\\(AM_INIT_AUTOMAKE\\).*|\\1([$1])|" <$2 >$2-t + mv -f $2-t $2 + set -x + cat $2 +} + # Files required in gnu strictness. touch README INSTALL NEWS AUTHORS ChangeLog COPYING @@ -51,4 +60,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 + : -- 1.7.2.3