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): fix wrong error for undefined variable...
details: https://anonhg.NetBSD.org/src/rev/dc9039dd8e1d
branches: trunk
changeset: 955007:dc9039dd8e1d
user: rillig <rillig%NetBSD.org@localhost>
date: Mon Sep 14 21:55:53 2020 +0000
description:
make(1): fix wrong error for undefined variables in lint mode
diffstat:
usr.bin/make/unit-tests/opt-debug-lint.exp | 1 -
usr.bin/make/unit-tests/opt-debug-lint.mk | 5 +----
usr.bin/make/var.c | 8 +++++---
3 files changed, 6 insertions(+), 8 deletions(-)
diffs (58 lines):
diff -r d3d99d680afd -r dc9039dd8e1d usr.bin/make/unit-tests/opt-debug-lint.exp
--- a/usr.bin/make/unit-tests/opt-debug-lint.exp Mon Sep 14 21:52:49 2020 +0000
+++ b/usr.bin/make/unit-tests/opt-debug-lint.exp Mon Sep 14 21:55:53 2020 +0000
@@ -1,6 +1,5 @@
make: "opt-debug-lint.mk" line 19: Variable "X" is undefined
make: "opt-debug-lint.mk" line 41: Variable "UNDEF" is undefined
-make: "opt-debug-lint.mk" line 58: Variable "UNDEF" is undefined
make: Fatal errors encountered -- cannot continue
make: stopped in unit-tests
exit status 1
diff -r d3d99d680afd -r dc9039dd8e1d usr.bin/make/unit-tests/opt-debug-lint.mk
--- a/usr.bin/make/unit-tests/opt-debug-lint.mk Mon Sep 14 21:52:49 2020 +0000
+++ b/usr.bin/make/unit-tests/opt-debug-lint.mk Mon Sep 14 21:55:53 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: opt-debug-lint.mk,v 1.6 2020/09/14 21:52:49 rillig Exp $
+# $NetBSD: opt-debug-lint.mk,v 1.7 2020/09/14 21:55:53 rillig Exp $
#
# Tests for the -dL command line option, which runs additional checks
# to catch common mistakes, such as unclosed variable expressions.
@@ -52,9 +52,6 @@
# if the variable is indeed defined. Otherwise they are only parsed, and
# for parsing it doesn't make a difference whether the variable is defined
# or not.
-#
-# FIXME: As of 2020-09-14, the following line prints an error message saying
-# that UNDEF is undefined.
.if defined(UNDEF) && exists(${UNDEF})
. error
.endif
diff -r d3d99d680afd -r dc9039dd8e1d usr.bin/make/var.c
--- a/usr.bin/make/var.c Mon Sep 14 21:52:49 2020 +0000
+++ b/usr.bin/make/var.c Mon Sep 14 21:55:53 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: var.c,v 1.521 2020/09/14 20:43:44 rillig Exp $ */
+/* $NetBSD: var.c,v 1.522 2020/09/14 21:55:53 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -121,7 +121,7 @@
#include "metachar.h"
/* "@(#)var.c 8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.521 2020/09/14 20:43:44 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.522 2020/09/14 21:55:53 rillig Exp $");
#define VAR_DEBUG_IF(cond, fmt, ...) \
if (!(DEBUG(VAR) && (cond))) \
@@ -3557,7 +3557,9 @@
return VPE_OK;
}
- if ((eflags & VARE_UNDEFERR) && DEBUG(LINT)) {
+ if ((eflags & VARE_UNDEFERR) && (eflags & VARE_WANTRES) &&
+ DEBUG(LINT))
+ {
Parse_Error(PARSE_FATAL, "Variable \"%s\" is undefined",
varname);
free(varname);
Home |
Main Index |
Thread Index |
Old Index