URL:
<https://savannah.gnu.org/bugs/?59752>
Summary: feature request: quote/expand function
Project: make
Submitted by: alecov
Submitted on: Tue 22 Dec 2020 07:00:07 PM UTC
Severity: 3 - Normal
Item Group: Enhancement
Status: None
Privacy: Public
Assigned to: None
Open/Closed: Open
Discussion Lock: Any
Component Version: None
Operating System: None
Fixed Release: None
Triage Status: None
_______________________________________________________
Details:
It would be nice to have a $(quote) function which escapes a string for safe
use within $(eval) contexts:
That is:
define y
1 # x
z = 2
endef
$(eval x = $y) # x = 1, and introduces z = 2
$(eval x = $(quote $y)) # x = 1 # x\nz = 2
Also, the $(value) function is inconsistent with regards to $'s between simple
and recursive variables:
a1 = $x $$y \# z
a2 := $x $$y \# z
$(info $(value a1)) # Prints '$x $$y # z'
$(info $(value a2)) # Prints ' $y # z'
This also might give problems in $(eval) contexts eg:
$(eval b1 = $(value a1)) # b1 = $x $$y
$(eval b2 = $(value a2)) # b2 = $y
# $(quote $(value)) doesn't fit:
$(eval b1 = $(quote $(value a1))) # b1 = $$x $$$$y \# z
$(eval b2 = $(quote $(value a2))) # b2 = $$y \# z
Hence, I'd suggest also introducing $(expand) which is similar to $(quote)
above, but for variables:
$(eval b1 = $(expand a1))) # b1 = $x $$y \# z
$(eval b2 = $(expand a2))) # b2 = $$y \# z
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?59752>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/