bug-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Robert Bogomip
Subject: [bug #17448] Function argument parsing inconsistent in treatment of whitespace
Date: Wed, 16 Aug 2006 16:49:21 +0000
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.0.6) Gecko/20060808 Fedora/1.5.0.6-2.fc5 Firefox/1.5.0.6 pango-text

URL:
  <http://savannah.gnu.org/bugs/?17448>

                 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 , <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.






    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?17448>

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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]