emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] emacs-25 74e5d4e: Don't let cconv_convert insert a nil arg


From: Alan Mackenzie
Subject: [Emacs-diffs] emacs-25 74e5d4e: Don't let cconv_convert insert a nil argument into a `setq' form.
Date: Mon, 23 Nov 2015 14:10:18 +0000

branch: emacs-25
commit 74e5d4e21e7206693ce6ce999e884d75230ad33b
Author: Alan Mackenzie <address@hidden>
Commit: Alan Mackenzie <address@hidden>

    Don't let cconv_convert insert a nil argument into a `setq' form.
    
    Fixes bug#21983.
    * lisp/emacs-lisp/cconv.el (cconv-convert): Don't silently insert a nil last
    argument into a `setq' when there're an odd number of args.  This enables 
the
    byte compiler to issue a message in this case.
---
 lisp/emacs-lisp/cconv.el |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/lisp/emacs-lisp/cconv.el b/lisp/emacs-lisp/cconv.el
index efa9a3d..4a3c273 100644
--- a/lisp/emacs-lisp/cconv.el
+++ b/lisp/emacs-lisp/cconv.el
@@ -477,17 +477,19 @@ places where they originally did not directly appear."
        (while forms
          (let* ((sym (pop forms))
                 (sym-new (or (cdr (assq sym env)) sym))
-                (value (cconv-convert (pop forms) env extend)))
+                (value-in-list
+                 (and forms
+                      (list (cconv-convert (pop forms) env extend)))))
            (push (pcase sym-new
-                   ((pred symbolp) `(setq ,sym-new ,value))
-                   (`(car-safe ,iexp) `(setcar ,iexp ,value))
+                   ((pred symbolp) `(setq ,sym-new ,@value-in-list))
+                   (`(car-safe ,iexp) `(setcar ,iexp ,@value-in-list))
                    ;; This "should never happen", but for variables which are
                    ;; mutated+captured+unused, we may end up trying to `setq'
                    ;; on a closed-over variable, so just drop the setq.
                    (_ ;; (byte-compile-report-error
                     ;;  (format "Internal error in cconv of (setq %s ..)"
                     ;;          sym-new))
-                    value))
+                    (car value-in-list)))
                  prognlist)))
        (if (cdr prognlist)
            `(progn . ,(nreverse prognlist))



reply via email to

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