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

2011-01-14 Thread Stefano Lattarini
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  stefano.lattar...@gmail.com
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 @@ FMakefile.ams.
 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 FMakefile.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 Cset_strictness ($name)



Re: bug#7833: automake uses two different values for DejaGNU srcdir

2011-01-14 Thread Ralf Wildenhues
* Ian Lance Taylor wrote on Thu, Jan 13, 2011 at 06:29:39PM CET:
 Ralf Wildenhues writes:
 
  Am I correct in assuming that it is hopeless to assume GCC will work
  when either values are relative?
 
 Actually, as far as I know, GCC is likely to work with a relative
 srcdir.  The problem arises with DejaGNU .exp files which themselves
 change directories.  As far as I know, the GCC DejaGNU files do not do
 that.

Thanks for the feedback.

Through testing I found out again that DejaGNU does not cope with white
space in absolute directory names anyway, regardless of srcdir being
relative or absolute.  That obviates my first point.  Remains only the
fairly minor src+build-tree relocatability point.

I have these two alternative patches which I would both be happy with.
I should note that the Life is easiest comment dates back to the very
first addition of dejagnu support in Automake, from way before recorded
history where we could learn from a related bug.

Tried both in a multilib target directory in the GCC tree, both seem to
work.  Any preferences, from a DejaGNU standpoint?

Thanks,
Ralf

   * lib/am/dejagnu.am (check-DEJAGNU): Set srcdir to be relative,
   consistent with the --srcdir argument and the srcdir setting in
   site.exp.
   Report by Ian Lance Taylor in automake bug#7833.

--- am/dejagnu.am.orig  2011-01-14 20:27:32.0 +0100
+++ am/dejagnu.am.1 2011-01-14 20:27:38.0 +0100
@@ -1,5 +1,5 @@
 ## automake - create Makefile.in from Makefile.am
-## Copyright (C) 1994, 1995, 1996, 1997, 2000, 2001, 2003, 2006
+## Copyright (C) 1994, 1995, 1996, 1997, 2000, 2001, 2003, 2006, 2011
 ## Free Software Foundation, Inc.
 
 ## This program is free software; you can redistribute it and/or modify
@@ -43,8 +43,7 @@
 
 .PHONY: check-DEJAGNU
 check-DEJAGNU: site.exp
-## Life is easiest with an absolute srcdir, so do that.
-   srcdir=`$(am__cd) $(srcdir)  pwd`; export srcdir; \
+   srcdir='$(srcdir)'; export srcdir; \
EXPECT=$(EXPECT); export EXPECT; \
 ## Allow this to work when expect and DejaGnu are in tree.
 ## Only required when --cygnus in force.




   * lib/am/dejagnu.am (RUNTESTDEFAULTFLAGS): Quote argument
   to --srcdir.
   (site.exp): Set srcdir to $(abs_srcdir).
   Report by Ian Lance Taylor in automake bug#7833.

--- am/dejagnu.am.orig  2011-01-14 20:27:32.0 +0100
+++ am/dejagnu.am.2 2011-01-14 20:20:22.0 +0100
@@ -1,5 +1,5 @@
 ## automake - create Makefile.in from Makefile.am
-## Copyright (C) 1994, 1995, 1996, 1997, 2000, 2001, 2003, 2006
+## Copyright (C) 1994, 1995, 1996, 1997, 2000, 2001, 2003, 2006, 2011
 ## Free Software Foundation, Inc.
 
 ## This program is free software; you can redistribute it and/or modify
@@ -19,7 +19,7 @@
 DEJATOOL = $(PACKAGE)
 
 ## Default flags to pass to dejagnu.  The user can override this.
-RUNTESTDEFAULTFLAGS = --tool $$tool --srcdir $$srcdir
+RUNTESTDEFAULTFLAGS = --tool $$tool --srcdir $$srcdir
 
 ## In Cygnus mode, these are found in the build tree.
 ## Otherwise they are looked for in $PATH.
@@ -77,7 +77,7 @@
@echo '## these variables are automatically generated by make ##' 
site.tmp
@echo '# Do not edit here.  If you wish to override these values' 
site.tmp
@echo '# edit the last section' site.tmp
-   @echo 'set srcdir $(srcdir)' site.tmp
+   @echo 'set srcdir $(abs_srcdir)' site.tmp
@echo set objdir `pwd` site.tmp
 ## Quote the *_alias variables because they might be empty.
 ?BUILD?@echo 'set build_alias $(build_alias)' site.tmp