make(1): demonstrate parse error without error message in conditional
This commit is contained in:
parent
228797e51e
commit
94db50b820
|
@ -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 @@ CondParser_String(CondParser *par, Boolean doEval, Boolean strictLHS,
|
|||
&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?
|
||||
|
|
|
@ -49,6 +49,7 @@ CondParser_Eval: \\
|
|||
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
|
||||
|
|
|
@ -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 @@ ${:U\\\\}= backslash
|
|||
. 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".
|
||||
|
||||
|
|
Loading…
Reference in New Issue