From 43f5d8f6e01a942d312d8ccb33175d61e5c354dd Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Sun, 3 Jun 2001 17:16:39 +0000 Subject: [PATCH] * 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. --- ChangeLog | 9 +++++++ TODO | 3 --- automake.in | 67 +++++++++++++++++++++++++++++------------------ tests/Makefile.am | 2 +- tests/Makefile.in | 2 +- 5 files changed, 53 insertions(+), 30 deletions(-) diff --git a/ChangeLog b/ChangeLog index c34cdbc2..a806c970 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2001-06-02 Tom Tromey + + * 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. + 2001-06-01 Tom Tromey * tests/Makefile.am (XFAIL_TESTS): Added ltdeps.test. diff --git a/TODO b/TODO index fd2e6407..d2e235d9 100644 --- a/TODO +++ b/TODO @@ -269,9 +269,6 @@ Alex Hornby (maybe doesn't matter since people who even know about maintainer-clean already have a clue) -* There are probably more bugs in variable_conditions_sub along - the lines of the one that caused cond4.test to fail. - * reintroduce AM_FUNC_FNMATCH which sets LIBOBJS Then have automake know about fnmatch.h. [ probably should wait for autoconf to get right functionality ] diff --git a/automake.in b/automake.in index b967edfd..2a6df3c8 100755 --- a/automake.in +++ b/automake.in @@ -5228,7 +5228,9 @@ sub pretty_print_rule # $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 @@ sub variable_conditions ($) 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 @@ sub variable_conditionally_defined ($) # &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 @@ sub variable_conditions_sub $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 @@ sub variable_conditions_sub # 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); @@ -5819,23 +5853,6 @@ sub variable_conditions_sub # 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 # already handled everything in @this_conds along with their diff --git a/tests/Makefile.am b/tests/Makefile.am index dc6e2744..96e633b4 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -2,7 +2,7 @@ AUTOMAKE_OPTIONS = gnits -XFAIL_TESTS = subdir5.test ltdeps.test +XFAIL_TESTS = subdir5.test TESTS = \ acinclude.test \ diff --git a/tests/Makefile.in b/tests/Makefile.in index 3fe9bd27..4a9574a7 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -68,7 +68,7 @@ install_sh = @install_sh@ AUTOMAKE_OPTIONS = gnits -XFAIL_TESTS = subdir5.test ltdeps.test +XFAIL_TESTS = subdir5.test TESTS = \ acinclude.test \ -- 2.43.5