From 17d62de22ef9a503b1c4cac690e9a4ab27177a78 Mon Sep 17 00:00:00 2001 From: Alexandre Duret-Lutz Date: Thu, 14 Nov 2002 22:37:29 +0000 Subject: [PATCH] * automake.in (variable_defined): Thinko. * lib/Automake/ConditionalSet.pm (true): Simplify. (permutations): Fix documentation. (new): Don't simplify conditional sets that contain TRUE. Reported by Raja R Harinath. --- ChangeLog | 8 ++++++++ automake.in | 2 +- lib/Automake/ConditionalSet.pm | 35 ++++++++++------------------------ 3 files changed, 19 insertions(+), 26 deletions(-) diff --git a/ChangeLog b/ChangeLog index 06bfa58f..519b1b89 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2002-11-14 Alexandre Duret-Lutz + + * automake.in (variable_defined): Thinko. + * lib/Automake/ConditionalSet.pm (true): Simplify. + (permutations): Fix documentation. + (new): Don't simplify conditional sets that contain TRUE. + Reported by Raja R Harinath. + 2002-11-14 Eric Blake * lib/am/depend2.am: Add missing fi in c.obj rules. diff --git a/automake.in b/automake.in index fd8119d3..ebc29f0e 100755 --- a/automake.in +++ b/automake.in @@ -6531,7 +6531,7 @@ sub variable_defined ($;$) if (exists $targets{$var} && (! defined $cond || exists $targets{$var}{$cond})) { - for my $tcond ($cond || ! target_conditions ($var)->false) + for my $tcond ($cond || target_conditions ($var)->conds) { prog_error ("\$targets{$var}{$tcond} exists but " . "\$target_owner doesn't") diff --git a/lib/Automake/ConditionalSet.pm b/lib/Automake/ConditionalSet.pm index 91a93e7d..c0020961 100644 --- a/lib/Automake/ConditionalSet.pm +++ b/lib/Automake/ConditionalSet.pm @@ -99,8 +99,7 @@ false. As explained previously, the reference (object) returned is unique with respect to C<@conds>. For this purpose, duplicate elements are -ignored, and C<@conds> is rewriten as C<("TRUE")> if it contains -C<"TRUE">. +ignored. =cut @@ -128,12 +127,6 @@ sub new ($;@) # ConditionalSet as false for this reason. next if $cond->false; - # If we see true, then the whole set is true! - if ($cond->true && $#conds > 0) - { - return new Automake::ConditionalSet $cond; - } - # Store conditions as keys AND as values, because blessed # objects are converted to string when used as keys (so # at least we still have the value when we need to call @@ -218,10 +211,7 @@ conditions). Return 0 otherwise. sub true ($ ) { my ($self) = @_; - # To know whether a ConditionalSet covers all - # we invert it. invert() will set $self->{'true'}. - $self->invert unless exists $self->{'true'}; - return $self->{'true'}; + return $self->invert->false; } =item C<$str = $set-Estring> @@ -292,14 +282,14 @@ For instance consider this initial C. Calling $<$set-Epermutations> will return the following Conditional set. new Automake::ConditionalSet - (new Automake::Conditional ("COND1_TRUE", "COND2_TRUE", "COND2_TRUE"), - new Automake::Conditional ("COND1_FALSE","COND2_TRUE", "COND2_TRUE"), - new Automake::Conditional ("COND1_TRUE", "COND2_FALSE","COND2_TRUE"), - new Automake::Conditional ("COND1_FALSE","COND2_FALSE","COND2_TRUE"), - new Automake::Conditional ("COND1_TRUE", "COND2_TRUE", "COND2_FALSE"), - new Automake::Conditional ("COND1_FALSE","COND2_TRUE", "COND2_FALSE"), - new Automake::Conditional ("COND1_TRUE", "COND2_FALSE","COND2_FALSE"), - new Automake::Conditional ("COND1_FALSE","COND2_FALSE","COND2_FALSE")); + (new Automake::Conditional ("COND1_TRUE", "COND2_TRUE", "COND3_TRUE"), + new Automake::Conditional ("COND1_FALSE","COND2_TRUE", "COND3_TRUE"), + new Automake::Conditional ("COND1_TRUE", "COND2_FALSE","COND3_TRUE"), + new Automake::Conditional ("COND1_FALSE","COND2_FALSE","COND3_TRUE"), + new Automake::Conditional ("COND1_TRUE", "COND2_TRUE", "COND3_FALSE"), + new Automake::Conditional ("COND1_FALSE","COND2_TRUE", "COND3_FALSE"), + new Automake::Conditional ("COND1_TRUE", "COND2_FALSE","COND3_FALSE"), + new Automake::Conditional ("COND1_FALSE","COND2_FALSE","COND3_FALSE")); =cut @@ -372,11 +362,6 @@ sub invert($ ) # It's tempting to also set $res->{'invert'} to $self, but that # isn't a bad idea as $self hasn't been normalized in any way. # (Different inputs can produce the same inverted set.) - - # If $res is false, then $self covers all cases. The true() - # method relies on this function to figure that. - $self->{'true'} = $res->false; - return $res; } -- 2.43.5