automake-patches
[Top][All Lists]
Advanced

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

Patch: Fix for ltdeps.test


From: Tom Tromey
Subject: Patch: Fix for ltdeps.test
Date: 02 Jun 2001 19:06:43 -0600

Akim, what do you think of this patch?

Take a look at ltdeps.test.  For this test, we were getting `TRUE' as
the only condition for BuildSources, which is clearly wrong.  I think
this happened because variable_conditions_sub failed to incorporate
its own conditions into the return result.

I think this patch fixes the problem.

Part of the patch is just moving code out of variable_conditions_sub.
That part is correct.

I also think the changes in variable_conditions_sub are correct.
However I'm less sure of them.

I've noticed that if I remove the second loop in variable_conditions_sub
(the one "If we are being called on behalf of another variable..."),
then the three tests I was working with (ltdeps, cond3, and cond4) all
still pass.  I wonder if this code is required.  I don't understand it
any more :-(.  I chose not to remove it (yet).  The test suite passes
with the appended patch.

I'm not going to check this in until I hear from you (even if the
answer is "I don't know" :-).

2001-06-02  Tom Tromey  <address@hidden>

        * automake.in (variable_conditions_sub): Move parent-only code
        from here...
        (variable_conditions): ... to here.
        (variable_conditions_sub): Include this variable's conditions in
        the resulting condition list.
        * tests/Makefile.am (XFAIL_TESTS): Removed ltdeps.test.

Tom

Index: automake.in
===================================================================
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.1135
diff -u -r1.1135 automake.in
--- automake.in 2001/05/29 00:28:35     1.1135
+++ automake.in 2001/06/03 00:42:05
@@ -5228,7 +5228,9 @@
 # $STRING
 # &conditional_string(@COND-STACK)
 # --------------------------------
-# Build a string de
+# Build a string which denotes the conditional in @COND-STACK.  Some
+# simplifications are done: `TRUE' entries are elided, and any `FALSE'
+# entry results in a return of `FALSE'.
 sub conditional_string
 {
   my (@stack) = @_;
@@ -5732,10 +5734,26 @@
     my @uniq_list;
 
     %vars_scanned = ();
-    foreach my $cond (&variable_conditions_sub ($var, '', ()))
+
+    my @new_conds = &variable_conditions_sub ($var, '', ());
+    # Now we want to return all permutations of the subvariable
+    # conditions.
+    my %allconds = ();
+    foreach my $item (@new_conds)
     {
+       foreach (split (' ', $item))
+       {
+           s/^(.*)_(TRUE|FALSE)$/$1_TRUE/;
+           $allconds{$_} = 1;
+       }
+    }
+    @new_conds = &variable_conditions_permutations (sort keys %allconds);
+
+    foreach my $cond (@new_conds)
+    {
+       my $reduce = &variable_conditions_reduce (split (' ', $cond));
         next
-         if $cond eq 'FALSE';
+           if $reduce eq 'FALSE';
        $uniqify{$cond} = 1;
     }
 
@@ -5764,8 +5782,9 @@
 
 # &variable_conditions_sub ($VAR, $PARENT, @PARENT_CONDS)
 # -------------------------------------------------------
-# A subroutine of variable_conditions.  We only return conditions
-# which are true for all the conditions in @PARENT_CONDS.
+# A subroutine of variable_conditions.  This returns all the
+# conditions of $VAR which are satisfiable when all of @PARENT_CONDS
+# are true.
 sub variable_conditions_sub
 {
     my ($var, $parent, @parent_conds) = @_;
@@ -5779,13 +5798,18 @@
     $vars_scanned{$var} = 1;
 
     my @this_conds = ();
+    # Examine every condition under which $VAR is defined.
     foreach my $vcond (keys %{$var_value{$var}})
     {
+       # If this condition cannot be true when the parent conditions
+       # are true, then skip it.
        next
          if ! conditionals_true_when ((@parent_conds), ($vcond));
 
        push (@this_conds, $vcond);
 
+       # If $VAR references some other variable, then compute the
+       # conditions for that subvariable.
        push (@parent_conds, $vcond);
        my @subvar_conds = ();
        foreach (split (' ', $var_value{$var}{$vcond}))
@@ -5796,15 +5820,25 @@
            # Handle variable substitutions.
            if (/^\$\{(.*)\}$/ || /^\$\((.*)\)$/)
            {
-               push (@subvar_conds,
-                     &variable_conditions_sub ($1, $var, @parent_conds));
+
+               # Here we compute all the conditions under which the
+               # subvariable is defined.  Then we go through and add
+               # $VCOND to each.
+               my @svc = &variable_conditions_sub ($1, $var, @parent_conds);
+               foreach my $item (@svc)
+               {
+                   my $val = conditional_string ($vcond, split (' ', $item));
+                   $val ||= 'TRUE';
+                   push (@subvar_conds, $val);
+               }
            }
        }
        pop (@parent_conds);
 
        # If there are no conditional subvariables, then we want to
        # return this condition.  Otherwise, we want to return the
-       # permutations of the subvariables.
+       # permutations of the subvariables, taking into account the
+       # conditions of $VAR.
        if (! @subvar_conds)
        {
            push (@new_conds, $vcond);
@@ -5818,23 +5852,6 @@
     # Unset our entry in vars_scanned.  We only care about recursive
     # definitions.
     delete $vars_scanned{$var};
-
-    # If there are no parents, then this call is the top level call.
-    if (! $parent)
-      {
-       # Now we want to return all permutations of the subvariable
-       # conditions.
-       my %allconds = ();
-       foreach my $item (@new_conds)
-       {
-           foreach (split (' ', $item))
-           {
-               s/^(.*)_(TRUE|FALSE)$/$1_TRUE/;
-               $allconds{$_} = 1;
-           }
-       }
-       return &variable_conditions_permutations (sort keys %allconds);
-      }
 
     # If we are being called on behalf of another variable, we need to
     # return all possible permutations of the conditions.  We have



reply via email to

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