John F. Trudeau
2018-10-21 01:59:37 UTC
URL:
<https://savannah.gnu.org/bugs/?54870>
Summary: Defining macro with name of built-in function
Project: make
Submitted by: jftrudeau
Submitted on: 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
Discussion Lock: Any
Component Version: 4.2.1
Operating System: POSIX-Based
Fixed Release: None
Triage Status: None
_______________________________________________________
Details:
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.
_______________________________________________________
File Attachments:
-------------------------------------------------------
Date: Sun 21 Oct 2018 01:59:36 AM UTC Name: redefine-builtin.make Size: 784B
By: jftrudeau
<http://savannah.gnu.org/bugs/download.php?file_id=45250>
-------------------------------------------------------
Date: Sun 21 Oct 2018 01:59:36 AM UTC Name: redefine-builtin.out Size: 984B
By: jftrudeau
<http://savannah.gnu.org/bugs/download.php?file_id=45251>
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?54870>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
<https://savannah.gnu.org/bugs/?54870>
Summary: Defining macro with name of built-in function
Project: make
Submitted by: jftrudeau
Submitted on: 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
Discussion Lock: Any
Component Version: 4.2.1
Operating System: POSIX-Based
Fixed Release: None
Triage Status: None
_______________________________________________________
Details:
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.
_______________________________________________________
File Attachments:
-------------------------------------------------------
Date: Sun 21 Oct 2018 01:59:36 AM UTC Name: redefine-builtin.make Size: 784B
By: jftrudeau
<http://savannah.gnu.org/bugs/download.php?file_id=45250>
-------------------------------------------------------
Date: Sun 21 Oct 2018 01:59:36 AM UTC Name: redefine-builtin.out Size: 984B
By: jftrudeau
<http://savannah.gnu.org/bugs/download.php?file_id=45251>
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?54870>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/