From c89b5a0f8a3905c023eb196e453383c95a4f6a89 Mon Sep 17 00:00:00 2001 From: Alan Mackenzie Date: Mon, 23 Nov 2015 14:25:15 +0000 Subject: [PATCH] Issue a warning from the byte compiler on a malformed `setq' form. Partly fixes bug#20241. * lisp/emacs-lisp/bytecomp.el (byte-compile-setq): Issue a warning when a `setq' form with an odd number of arguments is compiled. --- lisp/emacs-lisp/bytecomp.el | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 024719168af..fc3bfc5fc51 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -3713,7 +3713,11 @@ discarding." (let ((args (cdr form))) (if args (while args - (byte-compile-form (car (cdr args))) + (if (eq (length args) 1) + (byte-compile-warn + "missing value for `%S' at end of setq" + (car args))) + (byte-compile-form (car (cdr args))) (or byte-compile--for-effect (cdr (cdr args)) (byte-compile-out 'byte-dup 0)) (byte-compile-variable-set (car args)) -- 2.39.2