automake-patches
[Top][All Lists]
Advanced

[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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]