automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 7/9] Warnings win over strictness in AUTOMAKE_OPTIONS.


From: Stefano Lattarini
Subject: Re: [PATCH 7/9] Warnings win over strictness in AUTOMAKE_OPTIONS.
Date: Fri, 14 Jan 2011 13:38:47 +0100
User-agent: KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; )

And below is the dif for the sanity check I'd like to squash in.

OK?

Regards,
  Stefano

-*-*-

diff --git a/ChangeLog b/ChangeLog
index 78452d8..82ef6a1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -8,6 +8,10 @@
        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.
 
 2011-01-02  Stefano Lattarini  <address@hidden>
diff --git a/lib/Automake/Options.pm b/lib/Automake/Options.pm
index 9f22178..d1b6af5 100644
--- a/lib/Automake/Options.pm
+++ b/lib/Automake/Options.pm
@@ -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.
@@ -345,14 +352,25 @@ sub _process_option_list (\%@)
   return 0;
 }
 
+# Note the sanity checks: these function should be called at most once for
+# each set of options having the same precedence; otherwise, we couldn't
+# guarantee that explicitly-specified warning levels take precedence
+# over strictness-implied ones.
+
 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)>



reply via email to

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