[bug #49841] flavor() function incorrectly shows function parameters as defined.

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[bug #49841] flavor() function incorrectly shows function parameters as defined.

Robert Morell
URL:
  <http://savannah.gnu.org/bugs/?49841>

                 Summary: flavor() function incorrectly shows function
parameters as defined.
                 Project: make
            Submitted by: None
            Submitted on: Wed 14 Dec 2016 03:33:07 PM UTC
                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:

This concerns the scope of function parameters when using the
flavor() function to see if they are defined.

Consider the following functions and subsequent calls:

inner =\
  $(info 1F="$(flavor 1)" 1V="$(1)" 2F="$(flavor 2)" 2V="$(2)")
outer = $(call inner,one)

$(call outer,one)
$(call outer,one,two)

This will produce the following output with make-4.2.90

1F="simple" 1V="one" 2F="undefined" 2V=""
1F="simple" 1V="one" 2F="simple"    2V=""

It appears that the scope of the parameters in the outer function intrudes
into the inner function for the flavor() function but not for the value of the
parameter.





    _______________________________________________________

Reply to this item at:

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

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


_______________________________________________
Bug-make mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-make
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[bug #49841] flavor() function incorrectly shows function parameters as defined.

Robert Morell
Follow-up Comment #1, bug #49841 (project make):

> It appears that the scope of the parameters in the outer function intrudes
into the inner function for the flavor() function but not for the value of the
parameter.

The origin() function is also affected.


When inner function takes less arguments than the outer one, make hides
"extra" arguments of outer scope by defining them with empty values in the
scope of inner function.

Moreover, these "hidden" arguments are automatic, so can't be redefined, for
example by $(eval 2:=aaa)

This looks like inconsistency - behavior of inner function depends on the
number of arguments of outer one.

May be better solution will be - instead of defining fake arguments in context
of inner function, just forbid looking up arguments in outer scope?

The patch (against git repository) is attached.

(file #41043)
    _______________________________________________________

Additional Item Attachment:

File name: gnu-make-git-49841.patch       Size:7 KB


    _______________________________________________________

Reply to this item at:

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

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


_______________________________________________
Bug-make mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/bug-make
Loading...