Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/make/unit-tests tests/make: prevent the bug from con...



details:   https://anonhg.NetBSD.org/src/rev/bd0b83b415a0
branches:  trunk
changeset: 1027186:bd0b83b415a0
user:      rillig <rillig%NetBSD.org@localhost>
date:      Thu Dec 09 23:57:19 2021 +0000

description:
tests/make: prevent the bug from cond.c 1.283 from happening again

diffstat:

 usr.bin/make/unit-tests/cond-op-or.exp |   2 +-
 usr.bin/make/unit-tests/cond-op-or.mk  |  10 +++++++++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diffs (38 lines):

diff -r b0047d1f90fe -r bd0b83b415a0 usr.bin/make/unit-tests/cond-op-or.exp
--- a/usr.bin/make/unit-tests/cond-op-or.exp    Thu Dec 09 23:02:46 2021 +0000
+++ b/usr.bin/make/unit-tests/cond-op-or.exp    Thu Dec 09 23:57:19 2021 +0000
@@ -1,4 +1,4 @@
-make: "cond-op-or.mk" line 43: Malformed conditional (0 ||| 0)
+make: "cond-op-or.mk" line 51: Malformed conditional (0 ||| 0)
 make: Fatal errors encountered -- cannot continue
 make: stopped in unit-tests
 exit status 1
diff -r b0047d1f90fe -r bd0b83b415a0 usr.bin/make/unit-tests/cond-op-or.mk
--- a/usr.bin/make/unit-tests/cond-op-or.mk     Thu Dec 09 23:02:46 2021 +0000
+++ b/usr.bin/make/unit-tests/cond-op-or.mk     Thu Dec 09 23:57:19 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: cond-op-or.mk,v 1.6 2020/10/24 08:46:08 rillig Exp $
+# $NetBSD: cond-op-or.mk,v 1.7 2021/12/09 23:57:19 rillig Exp $
 #
 # Tests for the || operator in .if conditions.
 
@@ -18,11 +18,19 @@
 .  error
 .endif
 
+
 # The right-hand side is not evaluated since the left-hand side is already
 # true.
 .if 1 || ${UNDEF}
 .endif
 
+# When an outer condition makes the '||' expression irrelevant, neither of its
+# operands must be evaluated.  This had been wrong in cond.c 1.283 from
+# 2021-12-09 and was reverted in cond.c 1.284 an hour later.
+.if 0 && (!defined(UNDEF) || ${UNDEF})
+.endif
+
+
 # The || operator may be abbreviated as |.  This is not widely known though
 # and is also not documented in the manual page.
 



Home | Main Index | Thread Index | Old Index