Module Name: src Committed By: rillig Date: Sun Sep 13 05:55:39 UTC 2020
Modified Files: src/usr.bin/make: var.c Log Message: make(1): improve implementation comment in Var_Parse To generate a diff of this commit: cvs rdiff -u -r1.505 -r1.506 src/usr.bin/make/var.c 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.505 src/usr.bin/make/var.c:1.506 --- src/usr.bin/make/var.c:1.505 Sat Sep 12 22:12:17 2020 +++ src/usr.bin/make/var.c Sun Sep 13 05:55:39 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.505 2020/09/12 22:12:17 rillig Exp $ */ +/* $NetBSD: var.c,v 1.506 2020/09/13 05:55:39 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,14 +69,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: var.c,v 1.505 2020/09/12 22:12:17 rillig Exp $"; +static char rcsid[] = "$NetBSD: var.c,v 1.506 2020/09/13 05:55:39 rillig Exp $"; #else #include <sys/cdefs.h> #ifndef lint #if 0 static char sccsid[] = "@(#)var.c 8.3 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: var.c,v 1.505 2020/09/12 22:12:17 rillig Exp $"); +__RCSID("$NetBSD: var.c,v 1.506 2020/09/13 05:55:39 rillig Exp $"); #endif #endif /* not lint */ #endif @@ -3537,16 +3537,16 @@ Var_Parse(const char **pp, GNode *ctxt, } /* The variable expression is based on an undefined variable. + * Nevertheless it needs a Var, for modifiers that access the + * variable name, such as :L or :?, and for modifiers that access + * the variable flags (VAR_JUNK, VAR_KEEP). + * * Most modifiers leave this expression in the "undefined" state - * (VAR_JUNK), only some modifiers like :D, :U, :L, :P turn this - * undefined expression into a defined expression. + * (VAR_JUNK), only a few modifiers like :D, :U, :L, :P turn this + * undefined expression into a defined expression (VAR_KEEP). * - * At the end, after applying all modifiers, if the expression is - * still undefined after applying all the modifiers, var_Error is - * returned. Until then, the expression needs a variable struct, - * for all the modifiers that need access to the variable name, - * such as :L or :?. - */ + * At the end, after applying all modifiers, if the expression + * is still !VAR_KEEP, Var_Parse will return var_Error. */ v = bmake_malloc(sizeof(Var)); v->name = varname; Buf_Init(&v->val, 1);