bug-make
[Top][All Lists]
Advanced

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

[bug #59584] ifeq with a space after the first open parenthesis


From: Paul D. Smith
Subject: [bug #59584] ifeq with a space after the first open parenthesis
Date: Sun, 6 Dec 2020 13:48:06 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.66 Safari/537.36

Update of bug #59584 (project make):

              Item Group:                     Bug => Enhancement            

    _______________________________________________________

Follow-up Comment #1:

The reason this happens is that for conditionals, preceding whitespace is
preserved in the left-hand side of the match, while trailing space is ignored.
 Bizarrely, for the right-hand side of the match leading whitespace is ignored
while trailing whitespace is preserved.

This gives the wholly unsupportable result that:


ifeq ( $(foo), $(foo))


is actually _false_, as is this:


ifeq ( $(foo),$(foo) )


while this is true:


ifeq ($(foo) , $(foo))


It's really frustrating to me how many of areas of makefile parsing paid
insufficient attention to this issue of handling leading/trailing space.

It's well-defined in make variable assignment and in MOST other places in
makefiles that leading whitespace is ignored and trailing whitespace is
preserved, but there are various places where this was not done and we keep
running into them bit by bit over time, after decades' worth of makefiles
exist where who knows how many would break if we fixed the syntax to be
consistent.

I always recommend to everyone that they remove all leading/trailing
whitespace in all conditionals, as a simple to remember and always-correct
rule.

I'll leave this open as an enhancement to consider addressing this in some
way.

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?59584>

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




reply via email to

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