]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
yacc: support variable expansions in *YFLAGS definition.
authorStefano Lattarini <stefano.lattarini@gmail.com>
Fri, 7 Jan 2011 20:52:56 +0000 (21:52 +0100)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Sun, 9 Jan 2011 15:14:13 +0000 (16:14 +0100)
This change fixes automake bug#7800.

* automake.in (lang_yacc_target_hook): Use 'value_as_list_recursive'
instead of 'variable_value' to get the value of *YFLAGS variables.
Related changes.
($DASH_D_PATTERN): Removed.
* tests/Makefile.am (XFAIL_TESTS): Remove yflags-var-expand.test.
* tests/yacc-clean.test: Remove workaround for now-fixed bug.
* NEWS: Update.

ChangeLog
NEWS
automake.in
tests/Makefile.am
tests/Makefile.in
tests/yacc-clean.test

index 8f6d3aede1f815bb9c848f9ee70a93a6889b4fed..06f9b8454d23bcaee7181dc227e30258d0cf7488 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2011-01-08   Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       yacc: support variable expansions in *YFLAGS definition.
+       This change fixes automake bug#7800.
+       * automake.in (lang_yacc_target_hook): Use 'value_as_list_recursive'
+       instead of 'variable_value' to get the value of *YFLAGS variables.
+       Related changes.
+       ($DASH_D_PATTERN): Removed.
+       * tests/Makefile.am (XFAIL_TESTS): Remove yflags-var-expand.test.
+       * tests/yacc-clean.test: Remove workaround for now-fixed bug.
+       * NEWS: Update.
+
 2011-01-08   Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        yacc: more tests on *YFLAGS support
diff --git a/NEWS b/NEWS
index 05759351d0619eaeaff129b2356a0f526c34341e..79860ad759442995ad877de0b39e7e1f91a0d694 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -56,6 +56,12 @@ Bugs fixed in 1.11.0a:
   - The code for automatic dependency tracking works around a Solaris
     make bug triggered by sources containing repeated slashes when the
     `subdir-objects' option was used.
+
+  - Automake now detects the presence of the `-d' flag in the various
+    `*YFLAGS' variables even when their definitions involve indirections
+    through other variables, such as in:
+      foo_opts = -d
+      AM_YFLAGS = $(foo_opts)
 \f
 New in 1.11:
 
index b97d4a6355d99dede6e0db6df19c09d59e542ab0..2bffe4814fea997b14fadeccac4f4dee173a98cb 100755 (executable)
@@ -208,8 +208,6 @@ my $INCLUDE_PATTERN = ('^include\s+'
                       . '|(\$\(srcdir\)/' . $PATH_PATTERN . ')'
                       . '|([^/\$]' . $PATH_PATTERN . '))\s*(#.*)?' . "\$");
 
-# Match `-d' as a command-line argument in a string.
-my $DASH_D_PATTERN = "(^|\\s)-d(\\s|\$)";
 # Directories installed during 'install-exec' phase.
 my $EXEC_DIR_PATTERN =
   '^(?:bin|sbin|libexec|sysconf|localstate|lib|pkglib|.*exec.*)' . "\$";
@@ -6063,11 +6061,14 @@ sub lang_yacc_target_hook
 {
     my ($self, $aggregate, $output, $input, %transform) = @_;
 
-    my $flag = $aggregate . "_YFLAGS";
-    my $flagvar = var $flag;
-    my $YFLAGSvar = var 'YFLAGS';
-    if (($flagvar && $flagvar->variable_value =~ /$DASH_D_PATTERN/o)
-       || ($YFLAGSvar && $YFLAGSvar->variable_value =~ /$DASH_D_PATTERN/o))
+    my $flagvar = var ($aggregate . "_YFLAGS");
+    my $YFLAGSvar = var ('YFLAGS');
+    # We cannot work reliably with conditionally-defined YFLAGS.
+    $flagvar->check_defined_unconditionally if $flagvar;
+    $YFLAGSvar->check_defined_unconditionally if $YFLAGSvar;
+    my @flags = $flagvar ? $flagvar->value_as_list_recursive : ();
+    my @YFLAGS = $YFLAGSvar ? $YFLAGSvar->value_as_list_recursive : ();
+    if (grep (/^-d$/, @flags) || grep (/^-d$/, @YFLAGS))
     {
        (my $output_base = $output) =~ s/$KNOWN_EXTENSIONS_PATTERN$//;
        my $header = $output_base . '.h';
index 490c4660b5383b26f7f178b75a97ba63366ba551..bb1d786b56858e1720d16052d905bd1013bb3f84 100644 (file)
@@ -21,7 +21,6 @@ all.test \
 auxdir2.test \
 cond17.test \
 gcj6.test \
-yflags-var-expand.test \
 txinfo5.test
 
 include $(srcdir)/parallel-tests.am
index 0addaf639a0c832bccc3f7029ddc3622c675db57..e83cf33444fa51239cc24137321c05d48d5d7778 100644 (file)
@@ -277,7 +277,6 @@ all.test \
 auxdir2.test \
 cond17.test \
 gcj6.test \
-yflags-var-expand.test \
 txinfo5.test
 
 parallel_tests = \
index a8df065acf7713b69c98e96f4cd23bf0b7d8b9c7..d6a3fcaa84654da83220a488e5cbe44aa8ba346c 100755 (executable)
@@ -62,10 +62,6 @@ END
 cat > sub2/Makefile.am << 'END'
 include $(top_srcdir)/sub1/Makefile.am
 AM_YFLAGS = -d
-## FIXME: these apparently redundant definitions are required to
-## work around automake bug#7800.
-bar_YFLAGS += -d
-qux_YFLAGS += -d
 END
 
 cat > sub1/parse.y << 'END'
@@ -86,7 +82,6 @@ int main ()
 END
 cp sub1/main.c sub2/main.c
 
-
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE -a