Module Name: src Committed By: rillig Date: Thu Dec 9 23:57:19 UTC 2021
Modified Files: src/usr.bin/make/unit-tests: cond-op-or.exp cond-op-or.mk Log Message: tests/make: prevent the bug from cond.c 1.283 from happening again To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/cond-op-or.exp cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/cond-op-or.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/usr.bin/make/unit-tests/cond-op-or.exp diff -u src/usr.bin/make/unit-tests/cond-op-or.exp:1.2 src/usr.bin/make/unit-tests/cond-op-or.exp:1.3 --- src/usr.bin/make/unit-tests/cond-op-or.exp:1.2 Thu Sep 10 22:44:08 2020 +++ src/usr.bin/make/unit-tests/cond-op-or.exp Thu Dec 9 23:57:19 2021 @@ -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 Index: src/usr.bin/make/unit-tests/cond-op-or.mk diff -u src/usr.bin/make/unit-tests/cond-op-or.mk:1.6 src/usr.bin/make/unit-tests/cond-op-or.mk:1.7 --- src/usr.bin/make/unit-tests/cond-op-or.mk:1.6 Sat Oct 24 08:46:08 2020 +++ src/usr.bin/make/unit-tests/cond-op-or.mk Thu Dec 9 23:57:19 2021 @@ -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.