bug-make
[Top][All Lists]
Advanced

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

[bug #56206] ifndef false positive for exported variable


From: Paul D. Smith
Subject: [bug #56206] ifndef false positive for exported variable
Date: Sun, 12 May 2019 18:42:06 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:66.0) Gecko/20100101 Firefox/66.0

Update of bug #56206 (project make):

                  Status:                    None => Not A Bug              
             Open/Closed:                    Open => Closed                 

    _______________________________________________________

Follow-up Comment #1:

This behavior is correct.  The confusion is because the ?= operator and the
ifndef operator have different behaviors for variables which are defined to
have an empty value.

ifdef/ifndef test whether the expansion of the variable is the empty string or
not:


ifndef variable-name

    If the variable variable-name has an empty value, the text-if-true is
effective;
    otherwise, the text-if-false, if any, is effective.


However, the ?= operator tests whether the variable is actually defined or
not, not whether it has an empty value:


There is another assignment operator for variables, ‘?=’. This is called a
conditional
variable assignment operator, because it only has an effect if the variable is
not
yet defined. This statement:

  FOO ?= bar

is exactly equivalent to this (see The origin Function):

  ifeq ($(origin FOO), undefined)
    FOO = bar
  endif

  Note that a variable set to an empty value is still defined, so ‘?=’
will not set that variable. 
-verbatim=

    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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