bug-make
[Top][All Lists]
Advanced

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

[bug #49093] ifdef checks for non-empty value, not definition


From: Danek Duvall
Subject: [bug #49093] ifdef checks for non-empty value, not definition
Date: Wed, 14 Sep 2016 21:57:08 +0000 (UTC)
User-agent: Mozilla/5.0 (X11; SunOS i86pc; rv:45.0) Gecko/20100101 Firefox/45.0

URL:
  <http://savannah.gnu.org/bugs/?49093>

                 Summary: ifdef checks for non-empty value, not definition
                 Project: make
            Submitted by: dduvall
            Submitted on: Wed 14 Sep 2016 09:57:06 PM GMT
                Severity: 3 - Normal
              Item Group: Bug
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
       Component Version: 4.2.1
        Operating System: POSIX-Based
           Fixed Release: None
           Triage Status: None

    _______________________________________________________

Details:

The info doc for "ifdef" is inconsistent.  It first says

    If the value of that variable has a non-empty value, the
    TEXT-IF-TRUE is effective

but then later says

    Note that 'ifdef' only tests whether a variable has a value.
    It does not expand the variable to see if that value is
    nonempty.

Perhaps I'm reading one of those two bits wrong?

At any rate, there seems to be a discrepancy in behavior between "ifdef" and
$(origin).  Again, perhaps there's something I'm missing, but the following
makefile demonstrates the issue.  If I leave VAR set to empty, then ifdef
thinks VAR is undefined, but origin thinks it's defined.  If I set VAR to a
non-empty value, both think it's defined.  If I remove the line entirely or
add "undefine VAR", then both think it's undefined.  I see this behavior with
4.2.1 and with 3.82.

VAR=

ifdef VAR
$(info ifdef thinks VAR is defined)
else
$(info ifdef thinks VAR is undefined)
endif

ifneq "$(origin VAR)" "undefined"
$(info ifneq/origin thinks VAR is defined)
else
$(info ifneq/origin thinks VAR is undefined)
endif

all:




    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?49093>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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