This is derived from [PATCH 10/10] of the older series.
It requires a review.

Thanks,
   Stefano

-*-*-

Warnings win over strictness in AUTOMAKE_OPTIONS.

This change ensures 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' (from
Automake::Option) in way that ensures that explicit warnings are
parsed only after the strictness level has been set.
* tests/warnings-win-over-strictness.test: Extend.
---
 ChangeLog                               |   13 +++++++++++++
 automake.in                             |   12 +++++-------
 tests/warnings-win-over-strictness.test |   18 +++++++++++++++++-
 3 files changed, 35 insertions(+), 8 deletions(-)

From 8f24d48632e9af2ba4e212bb769b1e8cbb27e75f Mon Sep 17 00:00:00 2001
From: Stefano Lattarini <stefano.lattar...@gmail.com>
Date: Mon, 20 Dec 2010 18:29:50 +0100
Subject: [PATCH 7/9] Warnings win over strictness in AUTOMAKE_OPTIONS.

This change ensures 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' (from
Automake::Option) in way that ensures that explicit warnings are
parsed only after the strictness level has been set.
* tests/warnings-win-over-strictness.test: Extend.
---
 ChangeLog                               |   13 +++++++++++++
 automake.in                             |   12 +++++-------
 tests/warnings-win-over-strictness.test |   18 +++++++++++++++++-
 3 files changed, 35 insertions(+), 8 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index edafbfd..fa2cfd3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,18 @@
 2011-01-02  Stefano Lattarini  <stefano.lattar...@gmail.com>
 
+	For PR automake/547:
+	Warnings win over strictness in AUTOMAKE_OPTIONS.
+	This change ensures 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' (from
+	Automake::Option) in way that ensures that explicit warnings are
+	parsed only after the strictness level has been set.
+	* tests/warnings-win-over-strictness.test: Extend.
+
+2011-01-02  Stefano Lattarini  <stefano.lattar...@gmail.com>
+
 	Change signature of 'Automake::Options::_process_option_list()'.
 	This only modifies internal details in the automake implementation,
 	bearing no externally visible effect, but preparing the way for the
diff --git a/automake.in b/automake.in
index b05a1bd..11b1ccb 100644
--- a/automake.in
+++ b/automake.in
@@ -1246,13 +1246,11 @@ 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 (@locvals, @options);
+      @locvals = $var->value_as_list_recursive (cond_filter => TRUE,
+						location => 1);
+      @options = map { { option => $_->[1], where => $_->[0] } } @locvals;
+      return 1 if process_option_list (@options);
     }
 
   # Override portability-recursive warning.
diff --git a/tests/warnings-win-over-strictness.test b/tests/warnings-win-over-strictness.test
index 53de473..9f6c1d9 100755
--- a/tests/warnings-win-over-strictness.test
+++ b/tests/warnings-win-over-strictness.test
@@ -40,7 +40,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
@@ -50,6 +51,7 @@ set_am_opts()
 touch README INSTALL NEWS AUTHORS ChangeLog COPYING
 
 cat > Makefile.am <<END
+AUTOMAKE_OPTIONS =
 FOO := bar
 END
 
@@ -60,6 +62,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
@@ -73,4 +77,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
+
 :
-- 
1.7.2.3

Reply via email to