Module Name: src
Committed By: rillig
Date: Sun Dec 10 20:17:24 UTC 2023
Modified Files:
src/usr.bin/make: var.c
src/usr.bin/make/unit-tests: vardebug.exp varname-dot-shell.exp
Log Message:
make: explain in the debug log why a variable assignment is ignored
To generate a diff of this commit:
cvs rdiff -u -r1.1081 -r1.1082 src/usr.bin/make/var.c
cvs rdiff -u -r1.30 -r1.31 src/usr.bin/make/unit-tests/vardebug.exp
cvs rdiff -u -r1.17 -r1.18 src/usr.bin/make/unit-tests/varname-dot-shell.exp
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/var.c
diff -u src/usr.bin/make/var.c:1.1081 src/usr.bin/make/var.c:1.1082
--- src/usr.bin/make/var.c:1.1081 Sun Dec 10 20:12:28 2023
+++ src/usr.bin/make/var.c Sun Dec 10 20:17:23 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: var.c,v 1.1081 2023/12/10 20:12:28 rillig Exp $ */
+/* $NetBSD: var.c,v 1.1082 2023/12/10 20:17:23 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -139,7 +139,7 @@
#include "metachar.h"
/* "@(#)var.c 8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.1081 2023/12/10 20:12:28 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.1082 2023/12/10 20:17:23 rillig Exp $");
/*
* Variables are defined using one of the VAR=value assignments. Their
@@ -937,7 +937,9 @@ Var_SetWithFlags(GNode *scope, const cha
}
if (scope == SCOPE_GLOBAL && ExistsInCmdline(name)) {
- DEBUG3(VAR, "%s: %s = %s ignored!\n",
+ DEBUG3(VAR,
+ "%s: ignoring '%s' = '%s' "
+ "due to a command line variable of the same name\n",
SCOPE_GLOBAL->name, name, val);
return;
}
Index: src/usr.bin/make/unit-tests/vardebug.exp
diff -u src/usr.bin/make/unit-tests/vardebug.exp:1.30 src/usr.bin/make/unit-tests/vardebug.exp:1.31
--- src/usr.bin/make/unit-tests/vardebug.exp:1.30 Thu Jun 1 20:56:35 2023
+++ src/usr.bin/make/unit-tests/vardebug.exp Sun Dec 10 20:17:23 2023
@@ -7,7 +7,7 @@ Global: delete VAR
Global: delete VAR (not found)
Var_SetExpand: variable name "${:U}" expands to empty string, with value "empty name" - ignored
Var_AppendExpand: variable name "${:U}" expands to empty string, with value "empty name" - ignored
-Global: FROM_CMDLINE = overwritten ignored!
+Global: ignoring 'FROM_CMDLINE' = 'overwritten' due to a command line variable of the same name
Global: VAR = 1
Global: VAR = 1 2
Global: VAR = 1 2 3
Index: src/usr.bin/make/unit-tests/varname-dot-shell.exp
diff -u src/usr.bin/make/unit-tests/varname-dot-shell.exp:1.17 src/usr.bin/make/unit-tests/varname-dot-shell.exp:1.18
--- src/usr.bin/make/unit-tests/varname-dot-shell.exp:1.17 Sat Dec 9 00:13:38 2023
+++ src/usr.bin/make/unit-tests/varname-dot-shell.exp Sun Dec 10 20:17:23 2023
@@ -5,7 +5,7 @@ Global: delete .SHELL (not found)
Command: .SHELL = (details omitted)
Global: ORIG_SHELL = (details omitted)
Parsing line 12: .SHELL= overwritten
-Global: .SHELL = overwritten ignored!
+Global: ignoring '.SHELL' = 'overwritten' due to a command line variable of the same name
CondParser_Eval: ${.SHELL} != ${ORIG_SHELL}
Var_Parse: ${.SHELL} != ${ORIG_SHELL} (eval-defined)
Var_Parse: ${ORIG_SHELL} (eval-defined)
@@ -20,7 +20,7 @@ Comparing "(details omitted)" != "(detai
Parsing line 27: .undef .SHELL
Global: delete .SHELL (not found)
Parsing line 28: .SHELL= newly overwritten
-Global: .SHELL = newly overwritten ignored!
+Global: ignoring '.SHELL' = 'newly overwritten' due to a command line variable of the same name
CondParser_Eval: ${.SHELL} != ${ORIG_SHELL}
Var_Parse: ${.SHELL} != ${ORIG_SHELL} (eval-defined)
Var_Parse: ${ORIG_SHELL} (eval-defined)