bugmake - Bugs: bug #59662, ifdef tracking is confused by...


bug #59662: ifdef tracking is confused by define/endef

Submitter:  Paul D. Smith <psmith>
Submitted:  Fri 11 Dec 2020 05:52:22 PM UTC
Severity:  3 - Normal Item Group:  Bug
Status:  None Privacy:  Public
Assigned to:  None Open/Closed:  Open
Component Version:  3.81 Operating System:  Any
Fixed Release:  None Triage Status:  None
* Mandatory Fields

Add a New Comment Rich Markup

Fri 11 Dec 2020 05:52:22 PM UTC, original submission:  

This was reported 5 years ago on StackOverflow but apparently never published here (even though I suggested it and gave a link :)).  In this makefile, make gets confused by the ifeq that appears inside the define:

ifdef FALSE            # 1
 $(info outer)
 define macro          # 2
  $(info define)
  ifeq ($(1),1)
   $(info inner start)
   define inner_macro  # 3
    $(info inner define)
   endef               # 4
   $(info inner end)
  $(info if end)
 $(info outer end)

Basically the entirety of the content should be ignored because "ifdef FALSE" is false.  But that's not what happens:

$ make
if end
Makefile:13: *** missing separator.  Stop.

It seems that the parsing here gets confused and when the make parser sees the endef at #4 it matches it with the define at #2 (remember this entire thing should be ignored, so we shouldn't be tracking define/endef here at all!!) and the parsing becomes live again.

Paul D. Smith <psmith>
Group administrator


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

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by psmith (Submitted the item)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.


    No changes have been made to this item

    Back to the top

    Powered by Savane 3.13-58d6.
    Corresponding source code