bugmake - Bugs: bug #17448, Function argument parsing...

 
 

bug #17448: Function argument parsing inconsistent in treatment of whitespace

Submitted by:  Robert Bogomip <bobbogo>
Submitted on:  Wed 16 Aug 2006 04:49:18 PM UTC  
 
Severity: 3 - NormalItem Group: Bug
Status: NonePrivacy: Public
Assigned to: NoneOpen/Closed: Open
Component Version: 3.80Operating System: Any
Fixed Release: NoneTriage Status: None

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Wed 16 Aug 2006 04:49:18 PM UTC, original submission:

What does this makefile produce?

$ cat Makefile
e :=
s := $e hello there $e
$(warning if: [$(if $e , some , <none> )])
$(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:,[,<none>,]
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.

Robert Bogomip <bobbogo>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

Do you think this task is very important?
If so, you can click here to add your encouragement to it.
This task has 0 encouragements so far.

Only logged-in users can vote.

 

Please enter the title of George Orwell's famous dystopian book (it's a date):

 

 

No Changes Have Been Made to This Item

Back to the top


Powered by Savane 3.1-cleanup1