Module Name: src Committed By: rillig Date: Thu Dec 10 16:47:42 UTC 2020
Modified Files: src/usr.bin/make/unit-tests: varmod-ifelse.mk Log Message: make(1): document limitations of deferred '$' in ':?' modifier To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/varmod-ifelse.mk 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/unit-tests/varmod-ifelse.mk diff -u src/usr.bin/make/unit-tests/varmod-ifelse.mk:1.7 src/usr.bin/make/unit-tests/varmod-ifelse.mk:1.8 --- src/usr.bin/make/unit-tests/varmod-ifelse.mk:1.7 Thu Dec 10 16:36:47 2020 +++ src/usr.bin/make/unit-tests/varmod-ifelse.mk Thu Dec 10 16:47:42 2020 @@ -1,4 +1,4 @@ -# $NetBSD: varmod-ifelse.mk,v 1.7 2020/12/10 16:36:47 rillig Exp $ +# $NetBSD: varmod-ifelse.mk,v 1.8 2020/12/10 16:47:42 rillig Exp $ # # Tests for the ${cond:?then:else} variable modifier, which evaluates either # the then-expression or the else-expression, depending on the condition. @@ -99,6 +99,11 @@ COND:= ${${UNDEF} == "":?bad-assign:bad- # the '$' of the intended '${VAR}' escapes from the parser in form of the # expression ${:U\$}. Because of this escaping, the variable "name" and thus # the condition ends up as "${VAR} == value", just as intended. +# +# This hack does not work for variables from .for loops since these are +# expanded at parse time to their corresponding ${:Uvalue} expressions. +# Making the '$' of the '${VAR}' expression indirect hides this expression +# from the parser of the .for loop body. See SubstVarLong. .MAKEFLAGS: -dc VAR= value .if ${ ${:U\$}{VAR} == value :?ok:bad} != "ok"