automake-patches
[Top][All Lists]
Advanced

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

Re: FYI: ConditionalSet.pm


From: Alexandre Duret-Lutz
Subject: Re: FYI: ConditionalSet.pm
Date: Fri, 15 Nov 2002 01:11:08 +0100
User-agent: Gnus/5.090008 (Oort Gnus v0.08) Emacs/20.7 (i386-debian-linux-gnu)

>>> "adl" == Alexandre Duret-Lutz <address@hidden> writes:

[...]

 adl> I'll make a separate patch for this, as I'm not entirely sure I
 adl> understood what you meant.

Does this looks ok?

(This all calls for unit tests, I'll try to have look at that
this week-end.)

2002-11-15  Alexandre Duret-Lutz  <address@hidden>

        * lib/Automake/ConditionalSet.pm (_permutations_worker): Ignore TRUE
        conditions.
        (permutations): Treat empty permutations as TRUE.
        Suggested by Raja R Harinath.

Index: lib/Automake/ConditionalSet.pm
===================================================================
RCS file: /cvs/automake/automake/lib/Automake/ConditionalSet.pm,v
retrieving revision 1.2
diff -u -r1.2 ConditionalSet.pm
--- lib/Automake/ConditionalSet.pm      14 Nov 2002 22:37:30 -0000      1.2
+++ lib/Automake/ConditionalSet.pm      15 Nov 2002 00:07:34 -0000
@@ -2,7 +2,7 @@
 
 use Carp;
 use strict;
-use Automake::Conditional;
+use Automake::Conditional qw/TRUE FALSE/;
 
 =head1 NAME
 
@@ -247,23 +247,23 @@
   return () unless @conds;
 
   my $cond = shift @conds;
+
+  # Ignore "TRUE" conditions, since they add nothing to permutations.
+  return &_permutations_worker (@conds) if $cond eq "TRUE";
+
   (my $neg = $cond) =~ s/TRUE$/FALSE/;
 
   # Recurse.
-
-  # Don't merge `FALSE' conditions, since this will just create
-  # a false Conditional, and we'll drop them later in ConditionalSet.
-  # (Dropping them now limits the combinatoric explosion.)
   my @ret = ();
   foreach my $c (&_permutations_worker (@conds))
     {
       push (@ret, $c->merge_conds ($cond));
-      push (@ret, $c->merge_conds ($neg)) if $neg ne 'FALSE';
+      push (@ret, $c->merge_conds ($neg));
     }
   if (! @ret)
     {
       push (@ret, new Automake::Conditional $cond);
-      push (@ret, new Automake::Conditional $neg) if $neg ne 'FALSE';
+      push (@ret, new Automake::Conditional $neg);
     }
 
   return @ret;
@@ -311,6 +311,9 @@
     }
 
   my @res = _permutations_worker (keys %atomic_conds);
+  # An empty permutation is TRUE, because we ignore TRUE conditions
+  # in the recursions.
+  @res = (TRUE) unless @res;
   my $res = new Automake::ConditionalSet @res;
 
   $self->{'permutations'} = $res;
-- 
Alexandre Duret-Lutz





reply via email to

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