bug-make
[Top][All Lists]
Advanced

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

[bug #64185] *** only one 'else' per conditional. Stop. due to else in r


From: Dmitry Goncharov
Subject: [bug #64185] *** only one 'else' per conditional. Stop. due to else in recipe
Date: Wed, 17 May 2023 08:04:35 -0400 (EDT)

Follow-up Comment #6, bug #64185 (project make):


> The error is caused not by the else in the recipe, but when adding the
$(warning ...) statement immediately preceding the make else.



all:
ifdef blah
junk:
    else
else
endif


Here, the parser sees rule 'all:' and begins its search for recipe lines of
'all:'. Then the parser sees 'ifdef blah'. 'blah' is not defined and the
parser
ignores the following line, which is 'junk:'. Then parser reads '\telse' and
takes
it as a recipe of 'all:'. Because the parser took one of the two elses as a
recipe,
there is no complain about extra elses in a conditional.


all:

$(info hello)
ifdef blah
junk:
    else
else
endif


Here, $(info hello) ends the search for recipe lines of 'all'.
By the time the parser reads 'ifdef blah' it is no longer looking for recipe
lines. The parser then ignores 'junk:', because 'blah' is not defined and
treats '\telse' as a conditional directive.
The parser then complains about two elses in conditional.

This all boils down to the fact that the parser ignores code in the branches
not
taken and does not know that 'junk:' begins a new rule.


    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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