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

 
 

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

Submitted by:  Paul D. Smith <psmith>
Submitted on:  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

Add a New Comment (Rich Markup)
   

You are not logged in

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

 

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)
  endif
  $(info if end)
endef
$(info outer end)
endif
all:;

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>
Project Administrator

 

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

Attach Files:
   
   
Comment:
   

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)
  •  

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

    Only logged-in users can vote.

     

     

     

    No changes have been made to this item

    Back to the top


    Powered by Savane 3.7