Module Name: src Committed By: rillig Date: Sat Nov 7 14:37:31 UTC 2020
Modified Files: src/usr.bin/make: cond.c src/usr.bin/make/unit-tests: cond-func-empty.exp cond-func-empty.mk Log Message: make(1): add test for parse error in condition using empty() To generate a diff of this commit: cvs rdiff -u -r1.179 -r1.180 src/usr.bin/make/cond.c cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/cond-func-empty.exp cvs rdiff -u -r1.8 -r1.9 src/usr.bin/make/unit-tests/cond-func-empty.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/cond.c diff -u src/usr.bin/make/cond.c:1.179 src/usr.bin/make/cond.c:1.180 --- src/usr.bin/make/cond.c:1.179 Sat Nov 7 14:11:58 2020 +++ src/usr.bin/make/cond.c Sat Nov 7 14:37:30 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: cond.c,v 1.179 2020/11/07 14:11:58 rillig Exp $ */ +/* $NetBSD: cond.c,v 1.180 2020/11/07 14:37:30 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -93,7 +93,7 @@ #include "dir.h" /* "@(#)cond.c 8.2 (Berkeley) 1/2/94" */ -MAKE_RCSID("$NetBSD: cond.c,v 1.179 2020/11/07 14:11:58 rillig Exp $"); +MAKE_RCSID("$NetBSD: cond.c,v 1.180 2020/11/07 14:37:30 rillig Exp $"); /* * The parsing of conditional expressions is based on this grammar: @@ -162,7 +162,7 @@ static unsigned int cond_min_depth = 0; * * TRUE when CondEvalExpression is called from Cond_EvalLine (.if etc) * FALSE when CondEvalExpression is called from ApplyModifier_IfElse - * since lhs is already expanded and we cannot tell if + * since lhs is already expanded, and at that point we cannot tell if * it was a variable reference or not. */ static Boolean lhsStrict; Index: src/usr.bin/make/unit-tests/cond-func-empty.exp diff -u src/usr.bin/make/unit-tests/cond-func-empty.exp:1.1 src/usr.bin/make/unit-tests/cond-func-empty.exp:1.2 --- src/usr.bin/make/unit-tests/cond-func-empty.exp:1.1 Sun Aug 16 12:07:51 2020 +++ src/usr.bin/make/unit-tests/cond-func-empty.exp Sat Nov 7 14:37:31 2020 @@ -1 +1,5 @@ -exit status 0 +make: "cond-func-empty.mk" line 150: Unclosed variable "WORD" +make: "cond-func-empty.mk" line 150: Malformed conditional (empty(WORD) +make: Fatal errors encountered -- cannot continue +make: stopped in unit-tests +exit status 1 Index: src/usr.bin/make/unit-tests/cond-func-empty.mk diff -u src/usr.bin/make/unit-tests/cond-func-empty.mk:1.8 src/usr.bin/make/unit-tests/cond-func-empty.mk:1.9 --- src/usr.bin/make/unit-tests/cond-func-empty.mk:1.8 Wed Sep 23 08:11:28 2020 +++ src/usr.bin/make/unit-tests/cond-func-empty.mk Sat Nov 7 14:37:31 2020 @@ -1,4 +1,4 @@ -# $NetBSD: cond-func-empty.mk,v 1.8 2020/09/23 08:11:28 rillig Exp $ +# $NetBSD: cond-func-empty.mk,v 1.9 2020/11/07 14:37:31 rillig Exp $ # # Tests for the empty() function in .if conditions, which tests a variable # expression for emptiness. @@ -146,5 +146,12 @@ ${:U WORD }= variable name with spaces . error .endif +# Parse error: missing closing parenthesis. +.if empty(WORD +. error +.else +. error +.endif + all: @:;