Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/make make(1): add test for parse error in condition ...



details:   https://anonhg.NetBSD.org/src/rev/7723d6af3884
branches:  trunk
changeset: 956772:7723d6af3884
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Nov 07 14:37:30 2020 +0000

description:
make(1): add test for parse error in condition using empty()

diffstat:

 usr.bin/make/cond.c                         |  6 +++---
 usr.bin/make/unit-tests/cond-func-empty.exp |  6 +++++-
 usr.bin/make/unit-tests/cond-func-empty.mk  |  9 ++++++++-
 3 files changed, 16 insertions(+), 5 deletions(-)

diffs (59 lines):

diff -r 78bff65b6478 -r 7723d6af3884 usr.bin/make/cond.c
--- a/usr.bin/make/cond.c       Sat Nov 07 14:32:12 2020 +0000
+++ b/usr.bin/make/cond.c       Sat Nov 07 14:37:30 2020 +0000
@@ -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 @@
  *
  * 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;
diff -r 78bff65b6478 -r 7723d6af3884 usr.bin/make/unit-tests/cond-func-empty.exp
--- a/usr.bin/make/unit-tests/cond-func-empty.exp       Sat Nov 07 14:32:12 2020 +0000
+++ b/usr.bin/make/unit-tests/cond-func-empty.exp       Sat Nov 07 14:37:30 2020 +0000
@@ -1,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
diff -r 78bff65b6478 -r 7723d6af3884 usr.bin/make/unit-tests/cond-func-empty.mk
--- a/usr.bin/make/unit-tests/cond-func-empty.mk        Sat Nov 07 14:32:12 2020 +0000
+++ b/usr.bin/make/unit-tests/cond-func-empty.mk        Sat Nov 07 14:37:30 2020 +0000
@@ -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 @@
 .  error
 .endif
 
+# Parse error: missing closing parenthesis.
+.if empty(WORD
+.  error
+.else
+.  error
+.endif
+
 all:
        @:;



Home | Main Index | Thread Index | Old Index