Module Name:    src
Committed By:   rillig
Date:           Tue Jan 14 21:34:09 UTC 2025

Modified Files:
        src/usr.bin/make: parse.c
        src/usr.bin/make/unit-tests: var-op-shell.exp

Log Message:
make: simplify code for evaluating the '!=' variable assignment

An undefined variable evaluates to an empty string, without an error
message.


To generate a diff of this commit:
cvs rdiff -u -r1.737 -r1.738 src/usr.bin/make/parse.c
cvs rdiff -u -r1.8 -r1.9 src/usr.bin/make/unit-tests/var-op-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/parse.c
diff -u src/usr.bin/make/parse.c:1.737 src/usr.bin/make/parse.c:1.738
--- src/usr.bin/make/parse.c:1.737	Tue Jan 14 21:23:17 2025
+++ src/usr.bin/make/parse.c	Tue Jan 14 21:34:09 2025
@@ -1,4 +1,4 @@
-/*	$NetBSD: parse.c,v 1.737 2025/01/14 21:23:17 rillig Exp $	*/
+/*	$NetBSD: parse.c,v 1.738 2025/01/14 21:34:09 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -105,7 +105,7 @@
 #include "pathnames.h"
 
 /*	"@(#)parse.c	8.3 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: parse.c,v 1.737 2025/01/14 21:23:17 rillig Exp $");
+MAKE_RCSID("$NetBSD: parse.c,v 1.738 2025/01/14 21:34:09 rillig Exp $");
 
 /* Detects a multiple-inclusion guard in a makefile. */
 typedef enum {
@@ -1841,7 +1841,7 @@ VarAssign_EvalShell(const char *name, co
 	char *output, *error;
 
 	cmd = FStr_InitRefer(uvalue);
-	Var_Expand(&cmd, SCOPE_CMDLINE, VARE_EVAL_DEFINED);
+	Var_Expand(&cmd, SCOPE_CMDLINE, VARE_EVAL);
 
 	output = Cmd_Exec(cmd.str, &error);
 	Var_SetExpand(scope, name, output);

Index: src/usr.bin/make/unit-tests/var-op-shell.exp
diff -u src/usr.bin/make/unit-tests/var-op-shell.exp:1.8 src/usr.bin/make/unit-tests/var-op-shell.exp:1.9
--- src/usr.bin/make/unit-tests/var-op-shell.exp:1.8	Sat Jan 11 21:21:33 2025
+++ src/usr.bin/make/unit-tests/var-op-shell.exp	Tue Jan 14 21:34:09 2025
@@ -8,7 +8,7 @@ Capturing the output of command "echo '$
 Global: OUTPUT = $$$$
 Global: .MAKEFLAGS =  -r -k -d v -d
 Global: .MAKEFLAGS =  -r -k -d v -d 0
-Var_Parse: ${UNDEF}y (eval-defined)
+Var_Parse: ${UNDEF}y (eval)
 Capturing the output of command "echo xy"
 Global: OUTPUT_OF_UNDEF = xy
 Var_Parse: ${OUTPUT_OF_UNDEF} != "xy" (eval-defined-loud)

Reply via email to