[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 07/10] Warnings win over strictness in AM_INIT_AUTOMAKE.
From: |
stefano . lattarini |
Subject: |
[PATCH 07/10] Warnings win over strictness in AM_INIT_AUTOMAKE. |
Date: |
Thu, 23 Dec 2010 12:27:43 +0100 |
From: Stefano Lattarini <address@hidden>
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 | 11 +++++++++++
lib/Automake/Options.pm | 15 ++++++++++-----
tests/warnings-win-over-strictness.test | 18 ++++++++++++++++++
3 files changed, 39 insertions(+), 5 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index c095001..69deb04 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
2010-12-20 Stefano Lattarini <address@hidden>
+ 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.
+
+2010-12-20 Stefano Lattarini <address@hidden>
+
Cleanup in module Automake::Options.
The previous change (v1.11-547-g4e4b85c) has left some loose ends
in the Automake::Options module, which can thus still profit from
diff --git a/lib/Automake/Options.pm b/lib/Automake/Options.pm
index 1461a38..5728895 100644
--- a/lib/Automake/Options.pm
+++ b/lib/Automake/Options.pm
@@ -191,6 +191,7 @@ Return 1 on error, 0 otherwise.
sub process_option_list ($@)
{
my ($where, @list) = @_;
+ my @warnings = ();
foreach (@list)
{
@@ -262,11 +263,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
{
@@ -275,6 +272,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 977ed64..46df480 100755
--- a/tests/warnings-win-over-strictness.test
+++ b/tests/warnings-win-over-strictness.test
@@ -37,6 +37,15 @@ ko()
test `wc -l <stderr` = 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,13 @@ ko -Wportability --foreign
ok --gnu -Wno-portability
ok -Wno-portability --gnu
+set_am_opts 'foreign -Wportability' configure.in
+ko
+set_am_opts '-Wportability foreign' configure.in
+ko
+set_am_opts 'gnu -Wno-portability' configure.in
+ok
+set_am_opts '-Wno-portability gnu' configure.in
+ok
+
:
--
1.7.2.3
- [PATCH 0/10] Explicit warning levels must always take precedence over those implied by the strictness, stefano . lattarini, 2010/12/23
- [PATCH 02/10] New test on silent-rules mode and portability warnings., stefano . lattarini, 2010/12/23
- [PATCH 03/10] Warnings win over strictness on command line., stefano . lattarini, 2010/12/23
- [PATCH 01/10] Add new tests on strictness and warnings precedence and overriding., stefano . lattarini, 2010/12/23
- [PATCH 05/10] Remove global/local distinction for automake options., stefano . lattarini, 2010/12/23
- [PATCH 04/10] Refactoring: new $automake_remake_options global variable., stefano . lattarini, 2010/12/23
- [PATCH 06/10] Cleanup in module Automake::Options., stefano . lattarini, 2010/12/23
- [PATCH 07/10] Warnings win over strictness in AM_INIT_AUTOMAKE.,
stefano . lattarini <=
- [PATCH 08/10] Add more tests about AUTOMAKE_OPTIONS., stefano . lattarini, 2010/12/23
- [PATCH 09/10] Change signature of 'Automake::Options::process_option_list()'., stefano . lattarini, 2010/12/23
- [PATCH 10/10] Warnings win over strictness in AUTOMAKE_OPTIONS., stefano . lattarini, 2010/12/23
- [PATCH 11/10] Update NEWS about the warnings-over-strictness precedence., Stefano Lattarini, 2010/12/24
- [PATCH 12/10] More checks on warnings/strictness in precedence ("metawarnings")., Stefano Lattarini, 2010/12/24