Module Name: src Committed By: rillig Date: Tue Jan 19 18:09:12 UTC 2021
Modified Files: src/usr.bin/make/unit-tests: cond-op.exp cond-op.mk Log Message: make(1): demonstrate missing error handling for malformed conditions To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/cond-op.exp cvs rdiff -u -r1.10 -r1.11 src/usr.bin/make/unit-tests/cond-op.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.exp diff -u src/usr.bin/make/unit-tests/cond-op.exp:1.7 src/usr.bin/make/unit-tests/cond-op.exp:1.8 --- src/usr.bin/make/unit-tests/cond-op.exp:1.7 Sun Nov 15 14:58:14 2020 +++ src/usr.bin/make/unit-tests/cond-op.exp Tue Jan 19 18:09:12 2021 @@ -11,6 +11,10 @@ make: "cond-op.mk" line 93: 1 0 0 => make: "cond-op.mk" line 93: 1 0 1 => 1 1 1 make: "cond-op.mk" line 93: 1 1 0 => 0 1 1 make: "cond-op.mk" line 93: 1 1 1 => 1 1 1 +make: "cond-op.mk" line 104: Malformed conditional (1 &&) +make: "cond-op.mk" line 115: Missing argument for ".error" +make: "cond-op.mk" line 121: Missing argument for ".error" +make: "cond-op.mk" line 129: Malformed conditional (0 ||) make: Fatal errors encountered -- cannot continue make: stopped in unit-tests exit status 1 Index: src/usr.bin/make/unit-tests/cond-op.mk diff -u src/usr.bin/make/unit-tests/cond-op.mk:1.10 src/usr.bin/make/unit-tests/cond-op.mk:1.11 --- src/usr.bin/make/unit-tests/cond-op.mk:1.10 Sun Nov 15 14:58:14 2020 +++ src/usr.bin/make/unit-tests/cond-op.mk Tue Jan 19 18:09:12 2021 @@ -1,4 +1,4 @@ -# $NetBSD: cond-op.mk,v 1.10 2020/11/15 14:58:14 rillig Exp $ +# $NetBSD: cond-op.mk,v 1.11 2021/01/19 18:09:12 rillig Exp $ # # Tests for operators like &&, ||, ! in .if conditions. # @@ -98,5 +98,39 @@ . endfor .endfor +# This condition is obviously malformed. It is properly detected and also +# was properly detected before 2021-01-19, but only because the left hand +# side of the '&&' evaluated to true. +.if 1 && +. error +.else +. error +.endif + +# FIXME: Don't accept this condition as syntactically valid. +# FIXME: CondParser_Factor, (void). +.if 0 && +. error +.else +. error +.endif + +# FIXME: Don't accept this condition as syntactically valid. +# FIXME: CondParser_Expr, (void). +.if 1 || +. error +.else +. error +.endif + +# This condition is obviously malformed. It is properly detected and also +# was properly detected before 2021-01-19, but only because the left hand +# side of the '||' evaluated to false. +.if 0 || +. error +.else +. error +.endif + all: @:;