]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
Warnings win over strictness in AUTOMAKE_OPTIONS.
authorStefano Lattarini <stefano.lattarini@gmail.com>
Mon, 20 Dec 2010 17:29:50 +0000 (18:29 +0100)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Sat, 15 Jan 2011 14:27:16 +0000 (15:27 +0100)
Ensure that, for what concerns the options specified in
AUTOMAKE_OPTIONS, explicitly-defined warnings always take
precedence over implicit strictness-implied warnings.

This finally fixes Automake bug#7669 a.k.a. PR/547.

* automake.in (handle_options): Call 'process_option_list'
only once per set of options.
* lib/Automake/Options.pm (process_global_option_list,
process_option_list): Add sanity checks.
($_options_processed, $_global_options_processed): New
internal variables, used by the sanity checks above.
* tests/warnings-win-over-strictness.test: Extend.

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

index 6c65edf380cf0eb2804f8a12508f539c17cac135..050ec979a0ac4c3ff7245c0dd9af9a3ee9dfe626 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
 2011-01-15  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
+       For PR automake/547:
+       Warnings win over strictness in AUTOMAKE_OPTIONS.
+       Ensure that, for what concerns the options specified in
+       AUTOMAKE_OPTIONS, explicitly-defined warnings always take
+       precedence over implicit strictness-implied warnings.
+       This finally fixes Automake bug#7669 a.k.a. PR/547.
+       * automake.in (handle_options): Call 'process_option_list'
+       only once per set of options.
+       * lib/Automake/Options.pm (process_global_option_list,
+       process_option_list): Add sanity checks.
+       ($_options_processed, $_global_options_processed): New
+       internal variables, used by the sanity checks above.
+       * tests/warnings-win-over-strictness.test: Extend.
+
        For PR automake/547:
        Change signature of 'Automake::Options::_process_option_list()'.
        This only modifies internal details in the automake implementation,
index 5d5af933dbeacea9b7f83b24de072f06b415463e..ef3b8a65b5fe255d3c75f736de46b29d83182128 100644 (file)
@@ -1244,13 +1244,10 @@ sub handle_options
          msg_var ('unsupported', $var,
                   "`AUTOMAKE_OPTIONS' cannot have conditional contents");
        }
-      foreach my $locvals ($var->value_as_list_recursive (cond_filter => TRUE,
-                                                         location => 1))
-       {
-         my ($where, $value) = @$locvals;
-         return 1 if process_option_list ({ option => $value,
-                                              where => $where});
-       }
+      my @options = map { { option => $_->[1], where => $_->[0] } }
+                       $var->value_as_list_recursive (cond_filter => TRUE,
+                                                      location => 1);
+      return 1 if process_option_list (@options);
     }
 
   # Override portability-recursive warning.
index 9f221784add0bf35f087406d6b80da5de30f9caa..31052c07042e75548a695f8ca1dea501a47d0194 100644 (file)
@@ -76,6 +76,12 @@ F<Makefile.am>s.
 use vars '%_options';          # From AUTOMAKE_OPTIONS
 use vars '%_global_options';   # from AM_INIT_AUTOMAKE or the command line.
 
+# Whether process_option_list has already been called for the current
+# Makefile.am.
+use vars '$_options_processed';
+# Whether process_global_option_list has already been called.
+use vars '$_global_options_processed';
+
 =head2 Constants
 
 =over 4
@@ -135,6 +141,7 @@ previous F<Makefile.am>.
 
 sub reset ()
 {
+  $_options_processed = 0;
   %_options = %_global_options;
   # The first time we are run,
   # remember the current setting as the default.
@@ -347,12 +354,18 @@ sub _process_option_list (\%@)
 
 sub process_option_list (@)
 {
+  prog_error "local options already processed"
+    if $_options_processed;
   return _process_option_list (%_options, @_);
+  $_options_processed = 1;
 }
 
 sub process_global_option_list (@)
 {
+  prog_error "global options already processed"
+    if $_global_options_processed;
   return _process_option_list (%_global_options, @_);
+  $_global_options_processed = 1;
 }
 
 =item C<set_strictness ($name)>
index eb0b3a7a914c349c7250f79c2d9074303cce7dfb..0db3176a4956bb4fa7c31248205ff8d4d6bd549d 100755 (executable)
@@ -38,7 +38,8 @@ ko ()
 set_am_opts()
 {
   set +x
-  sed -e "s|^\\(AM_INIT_AUTOMAKE\\).*|\\1([$1])|" <$2 >$2-t
+  sed <$2 >$2-t -e "s|^\\(AUTOMAKE_OPTIONS\\) *=.*|\\1 = $1|" \
+                -e "s|^\\(AM_INIT_AUTOMAKE\\).*|\\1([$1])|"
   mv -f $2-t $2
   set -x
   cat $2
@@ -48,6 +49,7 @@ set_am_opts()
 touch README INSTALL NEWS AUTHORS ChangeLog COPYING
 
 cat > Makefile.am <<END
+AUTOMAKE_OPTIONS =
 FOO := bar
 END
 
@@ -58,6 +60,8 @@ ko -Wportability --foreign
 ok --gnu -Wno-portability
 ok -Wno-portability --gnu
 
+set_am_opts '' Makefile.am
+
 rm -rf autom4te*.cache
 set_am_opts 'foreign -Wportability' configure.in
 ko
@@ -71,4 +75,16 @@ rm -rf autom4te*.cache
 set_am_opts '-Wno-portability gnu' configure.in
 ok
 
+rm -rf autom4te*.cache
+set_am_opts '' configure.in
+
+set_am_opts 'foreign -Wportability' Makefile.am
+ko
+set_am_opts '-Wportability foreign' Makefile.am
+ko
+set_am_opts 'gnu -Wno-portability' Makefile.am
+ok
+set_am_opts '-Wno-portability gnu' Makefile.am
+ok
+
 :