[bug #60799] Parser chokes on second expansion of a prerequisite with ; o #

2023-01-08 Thread Paul D. Smith
Update of bug #60799 (project make):

  Item Group:None => Enhancement


___

Reply to this item at:

  

___
Message sent via Savannah
https://savannah.gnu.org/




[bug #60799] Parser chokes on second expansion of a prerequisite with ; o #

2021-12-13 Thread Paul D. Smith
Follow-up Comment #6, bug #60799 (project make):

I understand what you're saying.  There's always a trade-off between having
things "just work" which often involves adding a lot of exceptions and special
cases, versus keeping behavior consistent and simple but forcing people to
take extra steps on their own.

In general the more complex that underlying behavior the more I like to keep
things consistent and simple and avoid special cases.

But, maybe this is a situation where the confusion of the simple behavior
warrants adding a special case.

___

Reply to this item at:

  

___
  Message sent via Savannah
  https://savannah.gnu.org/




[bug #60799] Parser chokes on second expansion of a prerequisite with ; o #

2021-11-25 Thread Dmitry Goncharov
Follow-up Comment #5, bug #60799 (project make):

> But my point is that $$ is NOT (intended to be) special to make.  That's why
make doesn't do parentheses matching which it sees it.

Sure, we can adopt this stance and say no parentheses matching for $$. i am
not sure this behavior is the most useful make can offer.

Do you think this behavior is consistent from the user's point of view?

This works fine

.SECONDEXPANSION:
hello: $$(shell echo world); touch $@


This does not work

.SECONDEXPANSION:
hello: $$(shell echo world;); touch $@


You are right that the proposed patch adds parentheses matching and thus makes
$$ special. As far as i understood, you have a concern about making $$
special?


___

Reply to this item at:

  

___
  Message sent via Savannah
  https://savannah.gnu.org/




[bug #60799] Parser chokes on second expansion of a prerequisite with ; o #

2021-09-06 Thread Paul D. Smith
Follow-up Comment #4, bug #60799 (project make):

But my point is that $$ is NOT (intended to be) special to make.  That's why
make doesn't do parentheses matching which it sees it.

In other words, to make this:


bye: $$(hello#world)


is treated the same way as this:


bye: D(hello#world)


for any character "D".  It's not special to make at all and so we don't do
anything special with the parens either.

I don't think it's inconsistent because that's what escaping a character
means: none of its special features are in force.  Personally I think it would
be inconsistent to treat an escaped "$" differently than any other character.

___

Reply to this item at:

  

___
  Message sent via Savannah
  https://savannah.gnu.org/




[bug #60799] Parser chokes on second expansion of a prerequisite with ; o #

2021-06-19 Thread Dmitry Goncharov
Follow-up Comment #3, bug #60799 (project make):

Yes, it is possible to store special characters in a variable.

i'd not bother fixing this, if not for the fact that make already supports
this input. It is just when second expansion is enabled the parser fails.

i don't think this inconsistency can be described in the manual.

This works fine
hello: $(shell echo world;)

This does not work
.SECONDEXPANSION:
hello: $$(shell echo world;)

___

Reply to this item at:

  

___
  Message sent via Savannah
  https://savannah.gnu.org/




[bug #60799] Parser chokes on second expansion of a prerequisite with ; o #

2021-06-19 Thread Paul D. Smith
Follow-up Comment #2, bug #60799 (project make):

I will look at the fix but I'm not sure I want to try to work around this.  If
"$$" appears in the prerequisite list then it's not special to make... this is
true regardless of whether second expansion is enabled or not.

As with all special characters the best way to mask them is by hiding them in
a variable:


$ cat Makefile
sem = ;
hash = \#

.SECONDEXPANSION:
all: who $$(shell echo hi 1>&2 $(sem) echo there 1>&2);@:
who: $$(shell echo 'hi $(hash) there' 1>&2);@:

$ make
hi
there
hi # there


Or of course you could put the entire thing in a variable which is even
simpler/cleaner:


$ cat Makefile
sem = $(shell echo hi 1>&2 ; echo there 1>&2)
hash = $(shell echo 'hi # there' 1>&2)

.SECONDEXPANSION:

all: who $$(sem);@:
who: $$(hash);@:

$ make
hi
there
hi # there


I'll need to think about whether adding more special casing to try to
recognize and manage variables/functions targeted at secondary expansion is
going to cause other issues.

___

Reply to this item at:

  

___
  Message sent via Savannah
  https://savannah.gnu.org/




[bug #60799] Parser chokes on second expansion of a prerequisite with ; o #

2021-06-19 Thread Dmitry Goncharov
Follow-up Comment #1, bug #60799 (project make):


[comment #0 original submission:]
> Parser chokes on second expansion of a prerequisite with ; o #
> 
> $ cat makefile 
> MAKEFLAGS+=--warn-undefined-variables
> .SECONDEXPANSION:
> hello: $$(shell echo world;)
> touch $@
> 
> bye: $$(hello#world)
> touch $@
> $ make hello
> makefile:7: *** unterminated variable reference.  Stop.
> $ make bye
> makefile:7: *** unterminated variable reference.  Stop.
> $ 
> 
> 
> Parser treats ; as a recipe delimiter and # as a comment delimiter.

(file #51584, file #51585)
___

Additional Item Attachment:

File name: sv_60799_se_semi_fix.diff  Size:4 KB
   


File name: sv_60799_se_semi_test.diff Size:3 KB
   




___

Reply to this item at:

  

___
  Message sent via Savannah
  https://savannah.gnu.org/




[bug #60799] Parser chokes on second expansion of a prerequisite with ; o #

2021-06-19 Thread Dmitry Goncharov
URL:
  

 Summary: Parser chokes on second expansion of a prerequisite
with ; o #
 Project: make
Submitted by: dgoncharov
Submitted on: Sat 19 Jun 2021 01:41:58 PM UTC
Severity: 3 - Normal
  Item Group: None
  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:

Parser chokes on second expansion of a prerequisite with ; o #

$ cat makefile 
MAKEFLAGS+=--warn-undefined-variables
.SECONDEXPANSION:
hello: $$(shell echo world;)
touch $@

bye: $$(hello#world)
touch $@
$ make hello
makefile:7: *** unterminated variable reference.  Stop.
$ make bye
makefile:7: *** unterminated variable reference.  Stop.
$ 


Parser treats ; as a recipe delimiter and # as a comment delimiter.




___

Reply to this item at:

  

___
  Message sent via Savannah
  https://savannah.gnu.org/