emacs-bug-tracker
[Top][All Lists]
Advanced

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

[debbugs-tracker] bug#21983: closed (emacs-25: cconv-convert makes inval


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#21983: closed (emacs-25: cconv-convert makes invalid transformations on `setq' forms.)
Date: Mon, 23 Nov 2015 14:14:01 +0000

Your message dated 23 Nov 2015 14:13:13 -0000
with message-id <address@hidden>
and subject line Re: bug#21983: emacs-25: cconv-convert makes invalid 
transformations on `setq' forms.
has caused the debbugs.gnu.org bug report #21983,
regarding emacs-25: cconv-convert makes invalid transformations on `setq' forms.
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
21983: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=21983
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: emacs-25: cconv-convert makes invalid transformations on `setq' forms. Date: Sun, 22 Nov 2015 18:10:43 +0000 User-agent: Mutt/1.5.23 (2014-03-12)
Hello, Emacs.

It is desirable for the byte compiler to detect `setq' forms with an odd
number of arguments.

However, when lexical binding is enabled, this is prevented by
cconv-convert.  This converts a `setq' form into several single `setq's,
and crucially, takes the liberty of supplying a nil argument to the last
`setq' should no argument have been present.  This is a bug.

Here's a patch which appears to fix the problem:



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 @@ cconv-convert
        (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))



Because cconv-convert is written in pcase rather than elisp, I may have
slipped up on some subtlety.  Would somebody please check I haven't.

Thanks!

-- 
Alan Mackenzie (Nuremberg, Germany).



--- End Message ---
--- Begin Message --- Subject: Re: bug#21983: emacs-25: cconv-convert makes invalid transformations on `setq' forms. Date: 23 Nov 2015 14:13:13 -0000 User-agent: tin/2.3.1-20141224 ("Tallant") (UNIX) (FreeBSD/10.1-RELEASE-p16 (amd64))
Fixed in emacs-25 branch.

-- 
Alan Mackenzie (Nuremberg, Germany).



--- End Message ---

reply via email to

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