bugmake - Bugs: bug #54870, Defining macro with name of...

 
 

bug #54870: Defining macro with name of built-in function

Submitter:  John F. Trudeau <jftrudeau>
Submitted:  Sun 21 Oct 2018 01:59:36 AM UTC
   
 
Severity:  3 - Normal Item Group:  Enhancement
Status:  None Privacy:  Public
Assigned to:  None Open/Closed:  Open
Component Version:  4.2.1 Operating System:  POSIX-Based
Fixed Release:  None Triage Status:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Sun 21 Oct 2018 01:16:14 PM UTC, comment #1: 

The special variable .FEATURES is intended to help solve this problem.  Unfortunately we don't always get every single feature added to this variable.

However in the case of $(or ...) that function was added in the same release (3.81) that the .FEATURES variable was introduced.  So, it should be sufficient to check if this variable is not empty:


ifneq (,$(.FEATURES))
  $(info have "or" function)
endif


Paul D. Smith <psmith>
Group administrator
Sun 21 Oct 2018 01:59:36 AM UTC, original submission:  

I experienced some confusion using the GNU Make Standard Library.

The heuristic to detect the existence of the "or" and "and" build-in functions is always false.  This causes "or" and "and" macros to be defined unconditionally.

The confusion arises because the "macro" definitions can be viewed, but they can never be executed with arguments.  They are silently ignored.  Referencing the "macro" without "call" arguments returns the "macro" definition without error.  "$(or THIS,THAT)" and "$(call or,THIS,THAT)" both reference the built-in function, which is probably sane.




Suggestion 1: Run-time switch to warn when a macro is defined with a build-in function name.

  --warn-redefined-functions

Suggestion 2: New Special Variable: .FUNCTIONS

  For Makefile package maintainers.

  ifeq (,$(filter and,$(.FUNCTIONS))
    and = $(if THIS,$(if THAT))
  endif

Suggestion 3: Don't allow macros to be defined with built-in function names.

Example Makefile Attached.

John F. Trudeau <jftrudeau>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #45250:  redefine-builtin.make added by jftrudeau (784B - application/octet-stream)
file #45251:  redefine-builtin.out added by jftrudeau (984B - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by psmith (Posted a comment)
  • -email is unavailable- added by jftrudeau (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-10-21 jftrudeau Attached File- Added redefine-builtin.make, #45250
        Attached File- Added redefine-builtin.out, #45251

    Back to the top

    Powered by Savane 3.13-3230.
    Corresponding source code