automake
[Top][All Lists]
Advanced

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

Re: sub conditionals_true_when (@@) [PATCH]


From: Richard Boulton
Subject: Re: sub conditionals_true_when (@@) [PATCH]
Date: Thu, 14 Jun 2001 20:04:08 +0100
User-agent: Mutt/1.2.5i

On Wed, Jun 13, 2001 at 11:44:52AM +0300, Kalle Olavi Niemitalo wrote:
> This bug is also causing the @TRUE@ conditions reported by
> Richard Boulton in "Bug with conditionals. [PATCH]".

You're right, this does seem to be the main cause of the problem I
reported.

I tried fixing the problem (by passing by reference instead).
Unfortunately, this doesn't solve the problem; rather, it reveals that
variable_conditions_reduce() is very bug ridden indeed.

There seem to be two further problems:

i)  variable_conditions_reduce() currently checks conditions for redundancy
    against only those conditions which it has already checked, rather than
    against all the conditions it hasn't yet discarded.  Thus, for example:

      "FOO", "FOO BAR" will not reduce

    (since first "FOO" is checked against the empty conditional and then
    "FOO BAR" is checked against "FOO"), but

      "FOO BAR", "FOO" will reduce to "FOO BAR"
      
    (since "FOO BAR" is checked against the empty conditional and then
    "FOO" is checked against "FOO BAR").

ii) The check for tautology of a condition performed by
    variable_conditions_reduce() checks whether all conditions in @CONDS are
    true for every condition in @WHENS.  What is wanted is a check whether
    each condition in @CONDS is true for any of the conditions in @WHENS.

    The check is also the wrong way round: it keeps a condition if it is
    tautologous, rather than discarding it.

I've put together another test case for this problem, cond12.test, which
calls variable_conditions_reduce() to check the exact results for a set of
inputs.  I've also put together a patch to fix the problem, which causes
cond11.test and cond12.test to pass (and all other tests to pass), and
removes a FIXME from the code.

The patch involves a straightforward fix for the bug reported by Kalle
Olavi Niemitalo and for problem (i) in this email.

(ii) is fixed by redefining the behaviour of conditionals_true_when() such
that it returns TRUE if all the @CONDS are true for a condition in @WHENS.
The behaviour when WHENS is empty is also altered to be more logical (this
is where the FIXME is fixed).

This should not affect any other code since conditionals_true_when() is
only called with an array of size != 1 in @WHENS by
variable_conditions_reduce().

The test suite all passes for me, including the two new tests, after this
patch is applied.  This patch supercedes the patch I submitted earlier.

Hoping for a reply this time. ;-)

-- 
Richard

Attachment: patch
Description: Text document


reply via email to

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