From 4e4588ab2e6931a39c98e7f928f211553c832033 Mon Sep 17 00:00:00 2001 From: Eshel Yaron Date: Fri, 15 Nov 2024 11:59:20 +0100 Subject: [PATCH] Warn about meta-calls with constant arguments --- lisp/emacs-lisp/bytecomp.el | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index b9b62040b5d..e7a63b97ac4 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -6073,6 +6073,15 @@ and corresponding effects." :use-external-socket) '(:name :service)))) +(defun bytecomp--check-funcall-args (form &optional f &rest _args) + (pcase f + (`(,(or 'function 'quote) ,(pred symbolp)) + (byte-compile-warn-x form "meta-call with constant argument."))) + form) + +(dolist (f '(funcall call-interactively funcall-interactively)) + (put f 'compiler-macro #'bytecomp--check-funcall-args)) + (provide 'byte-compile) (provide 'bytecomp) -- 2.39.5