]> code.delx.au - gnu-emacs/commitdiff
Byte compiler: Catch missing argument to `funcall'. Fixes bug#22051.
authorAlan Mackenzie <acm@muc.de>
Sun, 29 Nov 2015 16:17:07 +0000 (16:17 +0000)
committerAlan Mackenzie <acm@muc.de>
Sun, 29 Nov 2015 16:17:07 +0000 (16:17 +0000)
* lisp/emacs-lisp/bytecomp.el (byte-compile-funcall): When there's no argument
to `funcall', (i) Output an error message; (ii) Generate code to signal a
`wrong-number-of-arguments' error.

lisp/emacs-lisp/bytecomp.el

index 8fd2594fec80e420b609216f4ef21668750b4469..14173494eeb077cf537af0d8bce1c32d405c047e 100644 (file)
@@ -4013,8 +4013,13 @@ that suppresses all warnings during execution of BODY."
     (setq byte-compile--for-effect nil)))
 
 (defun byte-compile-funcall (form)
-  (mapc 'byte-compile-form (cdr form))
-  (byte-compile-out 'byte-call (length (cdr (cdr form)))))
+  (if (cdr form)
+      (progn
+        (mapc 'byte-compile-form (cdr form))
+        (byte-compile-out 'byte-call (length (cdr (cdr form)))))
+    (byte-compile-log-warning "`funcall' called with no arguments" nil :error)
+    (byte-compile-form '(signal 'wrong-number-of-arguments '(funcall 0))
+                       byte-compile--for-effect)))
 
 \f
 ;; let binding