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: sync comment for ApplyModifier_Assign wit...



details:   https://anonhg.NetBSD.org/src/rev/a05a1f2b1f3b
branches:  trunk
changeset: 959278:a05a1f2b1f3b
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Feb 06 21:40:14 2021 +0000

description:
make: sync comment for ApplyModifier_Assign with reality

In compat mode, empty shell commands are handled correctly since at
least 1993.

In jobs mode, empty shell commands are handled correctly since at least
job.c 1.93 from 2005-06-16.

The only place where empty shell commands led to problems was in
Cmd_Exec, but that has nothing to do with the example from the comment.
See var-op-shell.mk for more details.

diffstat:

 usr.bin/make/var.c |  23 ++++++++++++-----------
 1 files changed, 12 insertions(+), 11 deletions(-)

diffs (46 lines):

diff -r df62fd72fea3 -r a05a1f2b1f3b usr.bin/make/var.c
--- a/usr.bin/make/var.c        Sat Feb 06 21:24:19 2021 +0000
+++ b/usr.bin/make/var.c        Sat Feb 06 21:40:14 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: var.c,v 1.807 2021/02/05 05:42:39 rillig Exp $ */
+/*     $NetBSD: var.c,v 1.808 2021/02/06 21:40:14 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.807 2021/02/05 05:42:39 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.808 2021/02/06 21:40:14 rillig Exp $");
 
 typedef enum VarFlags {
        VAR_NONE        = 0,
@@ -3239,17 +3239,18 @@
 }
 
 /*
- * The ::= modifiers actually assign a value to the variable.
- * Their main purpose is in supporting modifiers of .for loop
- * iterators and other obscure uses.  They always expand to
- * nothing.  In a target rule that would otherwise expand to an
- * empty line they can be preceded with @: to keep make happy.
- * Eg.
+ * The ::= modifiers are special in that they do not read the variable value
+ * but instead assign to that variable.  They always expand to an empty
+ * string.
  *
- * foo:        .USE
+ * Their main purpose is in supporting .for loops that generate shell commands
+ * since an ordinary variable assignment at that point would terminate the
+ * dependency group for these targets.  For example:
+ *
+ * list-targets: .USE
  * .for i in ${.TARGET} ${.TARGET:R}.gz
- *     @: ${t::=$i}
- *     @echo blah ${t:T}
+ *     @${t::=$i}
+ *     @echo 'The target is ${t:T}.'
  * .endfor
  *
  *       ::=<str>      Assigns <str> as the new value of variable.



Home | Main Index | Thread Index | Old Index