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): demonstrate parse error without error ...
details: https://anonhg.NetBSD.org/src/rev/fecefcd01c5f
branches: trunk
changeset: 958819:fecefcd01c5f
user: rillig <rillig%NetBSD.org@localhost>
date: Thu Jan 21 14:08:09 2021 +0000
description:
make(1): demonstrate parse error without error message in conditional
diffstat:
usr.bin/make/cond.c | 14 +++++++++++---
usr.bin/make/unit-tests/cond-token-plain.exp | 1 +
usr.bin/make/unit-tests/cond-token-plain.mk | 10 +++++++++-
3 files changed, 21 insertions(+), 4 deletions(-)
diffs (71 lines):
diff -r 84d04e3081f0 -r fecefcd01c5f usr.bin/make/cond.c
--- a/usr.bin/make/cond.c Thu Jan 21 13:52:32 2021 +0000
+++ b/usr.bin/make/cond.c Thu Jan 21 14:08:09 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cond.c,v 1.246 2021/01/21 13:51:24 rillig Exp $ */
+/* $NetBSD: cond.c,v 1.247 2021/01/21 14:08:09 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -95,7 +95,7 @@
#include "dir.h"
/* "@(#)cond.c 8.2 (Berkeley) 1/2/94" */
-MAKE_RCSID("$NetBSD: cond.c,v 1.246 2021/01/21 13:51:24 rillig Exp $");
+MAKE_RCSID("$NetBSD: cond.c,v 1.247 2021/01/21 14:08:09 rillig Exp $");
/*
* The parsing of conditional expressions is based on this grammar:
@@ -467,8 +467,16 @@
&str);
/* TODO: handle errors */
if (str.str == var_Error) {
- if (parseResult == VPR_ERR)
+ if (parseResult == VPR_ERR) {
+ /*
+ * FIXME: Even if an error occurs,
+ * there is no guarantee that it is
+ * reported.
+ *
+ * See cond-token-plain.mk $$$$$$$$.
+ */
par->printedError = TRUE;
+ }
/*
* XXX: Can there be any situation in which
* a returned var_Error requires freeIt?
diff -r 84d04e3081f0 -r fecefcd01c5f usr.bin/make/unit-tests/cond-token-plain.exp
--- a/usr.bin/make/unit-tests/cond-token-plain.exp Thu Jan 21 13:52:32 2021 +0000
+++ b/usr.bin/make/unit-tests/cond-token-plain.exp Thu Jan 21 14:08:09 2021 +0000
@@ -49,6 +49,7 @@
make: "cond-token-plain.mk" line 168: Now the variable '\\' is defined.
CondParser_Eval: "unquoted\"quoted" != unquoted"quoted
lhs = "unquoted"quoted", rhs = "unquoted"quoted", op = !=
+CondParser_Eval: $$$$$$$$ != ""
make: Fatal errors encountered -- cannot continue
make: stopped in unit-tests
exit status 1
diff -r 84d04e3081f0 -r fecefcd01c5f usr.bin/make/unit-tests/cond-token-plain.mk
--- a/usr.bin/make/unit-tests/cond-token-plain.mk Thu Jan 21 13:52:32 2021 +0000
+++ b/usr.bin/make/unit-tests/cond-token-plain.mk Thu Jan 21 14:08:09 2021 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: cond-token-plain.mk,v 1.9 2021/01/21 13:52:32 rillig Exp $
+# $NetBSD: cond-token-plain.mk,v 1.10 2021/01/21 14:08:09 rillig Exp $
#
# Tests for plain tokens (that is, string literals without quotes)
# in .if conditions.
@@ -177,6 +177,14 @@
. error
.endif
+# FIXME: In CondParser_String, Var_Parse returns var_Error without a
+# corresponding error message.
+.if $$$$$$$$ != ""
+. error
+.else
+. error
+.endif
+
# See cond-token-string.mk for similar tests where the condition is enclosed
# in "quotes".
Home |
Main Index |
Thread Index |
Old Index