GNU bug report logs -
#14831
cl-member warnings during bootstrap
Previous Next
Reported by: Juanma Barranquero <lekktu <at> gmail.com>
Date: Tue, 9 Jul 2013 14:43:02 UTC
Severity: normal
Found in version 24.3.50
Done: Stefan Monnier <monnier <at> iro.umontreal.ca>
Bug is archived. No further changes may be made.
Full log
Message #43 received at 14831-done <at> debbugs.gnu.org (full text, mbox):
>> Aha! So it's the compiler-macro of add-to-list which turns an
>> add-to-list call into a cl-pushnew call, which is then macro-expanded to
>> something that uses cl-member, which should be turned into a plain
>> `member' by `cl--compiler-macro-member'. So it can be fixed by changing
>> the compiler-macro of add-to-list not to use cl-pushnew.
I installed the patch below which tightens things up a bit.
Stefan
=== modified file 'lisp/subr.el'
--- lisp/subr.el 2013-07-19 12:18:16 +0000
+++ lisp/subr.el 2013-07-22 16:46:55 +0000
@@ -1498,9 +1498,10 @@
;; FIXME: Something like this could be used for `set' as well.
(if (or (not (eq 'quote (car-safe list-var)))
(special-variable-p (cadr list-var))
- (and append compare-fn))
+ (not (macroexp-const-p append)))
exp
(let* ((sym (cadr list-var))
+ (append (eval append))
(msg (format "`add-to-list' can't use lexical var `%s'; use `push' or `cl-pushnew'"
sym))
;; Big ugly hack so we only output a warning during
@@ -1513,13 +1514,17 @@
(when (assq sym byte-compile--lexical-environment)
(byte-compile-log-warning msg t :error))))
(code
- (if append
(macroexp-let2 macroexp-copyable-p x element
- `(unless (member ,x ,sym)
- (setq ,sym (append ,sym (list ,x)))))
+ `(unless ,(if compare-fn
+ (progn
(require 'cl-lib)
- `(cl-pushnew ,element ,sym
- :test ,(or compare-fn '#'equal)))))
+ `(cl-member ,x ,sym :test ,compare-fn))
+ ;; For bootstrapping reasons, don't rely on
+ ;; cl--compiler-macro-member for the base case.
+ `(member ,x ,sym))
+ ,(if append
+ `(setq ,sym (append ,sym (list ,x)))
+ `(push ,x ,sym))))))
(if (not (macroexp--compiling-p))
code
`(progn
This bug report was last modified 11 years and 308 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.