]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
Warnings win over strictness in AM_INIT_AUTOMAKE.
authorStefano Lattarini <stefano.lattarini@gmail.com>
Mon, 20 Dec 2010 13:57:27 +0000 (14:57 +0100)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Sat, 15 Jan 2011 14:25:23 +0000 (15:25 +0100)
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.

ChangeLog
lib/Automake/Options.pm
tests/warnings-win-over-strictness.test

index 0db84ff3cd0256d73b8fc96f28cdfef84eb1e22f..a25f4008ef1dea58c92e41fd290d6830be3675fd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
 2011-01-15  Stefano Lattarini  <stefano.lattarini@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.  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
index a6d65a8eb8b6cd27731894444276b117e81e0938..a3607c3f7dc7f099bd6251a7ce06ce8ef1131f66 100644 (file)
@@ -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;
 }
 
index 27936ecf23556a929aeed144be1efb4d42397c12..eb0b3a7a914c349c7250f79c2d9074303cce7dfb 100755 (executable)
@@ -35,6 +35,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
 
@@ -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
+
 :