bug-make
[Top][All Lists]
Advanced

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

[bug #59662] ifdef tracking is confused by define/endef


From: Paul D. Smith
Subject: [bug #59662] ifdef tracking is confused by define/endef
Date: Fri, 11 Dec 2020 12:52:24 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36

URL:
  <https://savannah.gnu.org/bugs/?59662>

                 Summary: ifdef tracking is confused by define/endef
                 Project: make
            Submitted by: psmith
            Submitted on: Fri 11 Dec 2020 12:52:22 PM EST
                Severity: 3 - Normal
              Item Group: Bug
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
       Component Version: 3.81
        Operating System: Any
           Fixed Release: None
           Triage Status: None

    _______________________________________________________

Details:

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.




    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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