emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs-25 5cf012a: Byte compiler: Catch missing argument to


From: Alan Mackenzie
Subject: [Emacs-diffs] emacs-25 5cf012a: Byte compiler: Catch missing argument to `funcall'. Fixes bug#22051.
Date: Sun, 29 Nov 2015 16:18:17 +0000

branch: emacs-25
commit 5cf012a3a86e700b5f229fc14d9abd1e27fdb5f4
Author: Alan Mackenzie <address@hidden>
Commit: Alan Mackenzie <address@hidden>

    Byte compiler: Catch missing argument to `funcall'.  Fixes bug#22051.
    
    * 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 |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index 8fd2594..1417349 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -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)))
 
 
 ;; let binding



reply via email to

[Prev in Thread] Current Thread [Next in Thread]