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): document expansion of undefined variab...



details:   https://anonhg.NetBSD.org/src/rev/c1479fc5f0f3
branches:  trunk
changeset: 944259:c1479fc5f0f3
user:      rillig <rillig%NetBSD.org@localhost>
date:      Fri Sep 25 06:06:15 2020 +0000

description:
make(1): document expansion of undefined variables in Var_Subst

>From reading the code alone, it is not obvious what effects this
innocent-looking code has.

diffstat:

 usr.bin/make/var.c |  8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diffs (29 lines):

diff -r 7b1ba9984db6 -r c1479fc5f0f3 usr.bin/make/var.c
--- a/usr.bin/make/var.c        Fri Sep 25 05:56:59 2020 +0000
+++ b/usr.bin/make/var.c        Fri Sep 25 06:06:15 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: var.c,v 1.537 2020/09/25 05:04:51 rillig Exp $ */
+/*     $NetBSD: var.c,v 1.538 2020/09/25 06:06:15 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.537 2020/09/25 05:04:51 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.538 2020/09/25 06:06:15 rillig Exp $");
 
 #define VAR_DEBUG_IF(cond, fmt, ...)   \
     if (!(DEBUG(VAR) && (cond)))       \
@@ -3780,6 +3780,10 @@
                    p = nested_p;
                    errorReported = TRUE;
                } else {
+                   /* Copy the initial '$' of the undefined expression,
+                    * thereby deferring expansion of the expression, but
+                    * expand nested expressions if already possible.
+                    * See unit-tests/varparse-undef-partial.mk. */
                    Buf_AddByte(&buf, *p);
                    p++;
                }



Home | Main Index | Thread Index | Old Index