[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#14831: cl-member warnings during bootstrap
From: |
Stefan Monnier |
Subject: |
bug#14831: cl-member warnings during bootstrap |
Date: |
Mon, 22 Jul 2013 16:40:27 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) |
>> 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
- bug#14831: cl-member warnings during bootstrap, (continued)
- bug#14831: cl-member warnings during bootstrap, Juanma Barranquero, 2013/07/09
- bug#14831: cl-member warnings during bootstrap, Juanma Barranquero, 2013/07/15
- bug#14831: cl-member warnings during bootstrap, Glenn Morris, 2013/07/15
- bug#14831: cl-member warnings during bootstrap, Juanma Barranquero, 2013/07/15
- bug#14831: cl-member warnings during bootstrap, Glenn Morris, 2013/07/15
- bug#14831: cl-member warnings during bootstrap, Juanma Barranquero, 2013/07/15
- bug#14831: cl-member warnings during bootstrap, Stefan Monnier, 2013/07/15
- bug#14831: cl-member warnings during bootstrap, Glenn Morris, 2013/07/15
- bug#14831: cl-member warnings during bootstrap, Stefan Monnier, 2013/07/16
- bug#14831: cl-member warnings during bootstrap, Glenn Morris, 2013/07/16
- bug#14831: cl-member warnings during bootstrap,
Stefan Monnier <=