[bug #17448] Function argument parsing inconsistent in treatment of whitespace

2023-01-08 Thread Paul D. Smith
Follow-up Comment #2, bug #17448 (project make):

I pushed a fix for the $(file ...) function.

The other inconsistencies will need to be dealt with later... I don't want to
make backward-incompatible changes right now.


___

Reply to this item at:

  

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




[bug #17448] Function argument parsing inconsistent in treatment of whitespace

2021-10-04 Thread anonymous
Follow-up Comment #1, bug #17448 (project make):

I found a very annoying problem which seems related to this issue (and only
apply to v >= 4.2 which includes function `file`):

This one will read `filename`:
$(file https://savannah.gnu.org/bugs/?17448>

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




[bug #17448] Function argument parsing inconsistent in treatment of whitespace

2006-08-16 Thread Robert Bogomip

URL:
  

 Summary: Function argument parsing inconsistent in treatment
of whitespace
 Project: make
Submitted by: bobbogo
Submitted on: Wednesday 08/16/2006 at 16:49
Severity: 3 - Normal
  Item Group: Bug
  Status: None
 Privacy: Public
 Assigned to: None
 Open/Closed: Open
   Component Version: 3.80
Operating System: Any
   Fixed Release: None

___

Details:

What does this makefile produce?

$ cat Makefile
e :=
s := $e hello   there $e
$(warning if: [$(if $e , some ,  )])
$(warning and: [$(and a$e , $s )])
$(warning or: [$(or $e ,$s)])
$(warning patsubst:[$(patsubst aa,a,$s)])
$(warning patsubst:[$(patsubst aa%,a, $s )])
$(warning patsubst:[$(patsubst aa%%,a, $s )])
$(warning patsubst:[$(patsubst hello,,$s)])
$(warning patsubst:[$(patsubst hello ,,$s)])
args = $(warning args: [$1][$2][$3])
$(call   args ,$s, $s, $s )
$(error bye)

$ make380 2>&1 | tr ' ' ,
Makefile:3:,if:,[,some,]
Makefile:4:,and:,[]
Makefile:5:,or:,[]
Makefile:6:,patsubst:[,hello,,,there,]
Makefile:7:,patsubst:[hello,there]
Makefile:8:,patsubst:[hello,there]
Makefile:9:,patsubst:[there,]
Makefile:10:,patsubst:[,,,there,]
Makefile:12:,args:,[,hello,,,there,][,,hello,,,there,][,,hello,,,there,,]
Makefile:13:,***,bye.,,Stop.

$ make381 2>&1 | tr ' ' ,
Makefile:3:,if:,[,,]
Makefile:4:,and:,[,hello,,,there,]
Makefile:5:,or:,[,hello,,,there,]
Makefile:6:,patsubst:[,hello,,,there,]
Makefile:7:,patsubst:[hello,there]
Makefile:8:,patsubst:[hello,there]
Makefile:9:,patsubst:[there,]
Makefile:10:,patsubst:[,,,there,]
Makefile:12:,args:,[,hello,,,there,][,,hello,,,there,][,,hello,,,there,,]
Makefile:13:,***,bye.,,Stop.

Dunno how to rationalise this. Some functions strip w.s. from around all the
arguments (and, or); some from just the first argument (call); and patsubst
will $(strip) its last argument only when its first contains a % (even if
it's doubled as in %%).

Oh, and there's a regression in the 1st argument of $(if) from 3.80 to 3.81.

This is a documentation error if nothing else. The manual says "The arguments
are the arguments of the function. They are separated from the function name
by one or more spaces or tabs, and if there is more than one argument, then
they are separated by commas. Such whitespace and commas are not part of an
argument's value." Does the "such whitespace" in this snippet mean just the
w.s. between the function name and the first argument? It seems that only
$(patsubst) does it right in this regard.






___

Reply to this item at:

  

___
  Message sent via/by Savannah
  http://savannah.gnu.org/



___
Bug-make mailing list
Bug-make@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-make