From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#14831: cl-member warnings during bootstrap Date: Mon, 22 Jul 2013 16:40:27 -0400 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1374525672 1500 80.91.229.3 (22 Jul 2013 20:41:12 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 22 Jul 2013 20:41:12 +0000 (UTC) Cc: Juanma Barranquero , 14831-done@debbugs.gnu.org To: Glenn Morris Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Jul 22 22:41:12 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1V1Muu-0003Gh-Bz for geb-bug-gnu-emacs@m.gmane.org; Mon, 22 Jul 2013 22:41:12 +0200 Original-Received: from localhost ([::1]:41898 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1Muu-0002MQ-0c for geb-bug-gnu-emacs@m.gmane.org; Mon, 22 Jul 2013 16:41:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35377) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1Muo-0002I2-Q9 for bug-gnu-emacs@gnu.org; Mon, 22 Jul 2013 16:41:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V1Mun-000864-OR for bug-gnu-emacs@gnu.org; Mon, 22 Jul 2013 16:41:06 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:49125) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V1Mun-000860-Ly for bug-gnu-emacs@gnu.org; Mon, 22 Jul 2013 16:41:05 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1V1Mum-0006wW-7Q for bug-gnu-emacs@gnu.org; Mon, 22 Jul 2013 16:41:04 -0400 Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-To: bug-gnu-emacs@gnu.org Resent-Date: Mon, 22 Jul 2013 20:41:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 14831 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Mail-Followup-To: 14831@debbugs.gnu.org, monnier@iro.umontreal.ca, lekktu@gmail.com Original-Received: via spool by 14831-done@debbugs.gnu.org id=D14831.137452563826631 (code D ref 14831); Mon, 22 Jul 2013 20:41:02 +0000 Original-Received: (at 14831-done) by debbugs.gnu.org; 22 Jul 2013 20:40:38 +0000 Original-Received: from localhost ([127.0.0.1]:43431 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1V1MuL-0006vO-Uj for submit@debbugs.gnu.org; Mon, 22 Jul 2013 16:40:38 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.182]:40581) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1V1MuI-0006ul-7j for 14831-done@debbugs.gnu.org; Mon, 22 Jul 2013 16:40:34 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av8EABK/CFG4rw7r/2dsb2JhbABEuzWDWRdzgh4BAQQBViMQCw4mEhQYDSSIHgbBLZEKA6R6gV6DEw X-IPAS-Result: Av8EABK/CFG4rw7r/2dsb2JhbABEuzWDWRdzgh4BAQQBViMQCw4mEhQYDSSIHgbBLZEKA6R6gV6DEw X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="19556188" Original-Received: from 184-175-14-235.dsl.teksavvy.com (HELO pastel.home) ([184.175.14.235]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 22 Jul 2013 16:40:22 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id A8CD862EE3; Mon, 22 Jul 2013 16:40:27 -0400 (EDT) In-Reply-To: (Glenn Morris's message of "Tue, 16 Jul 2013 13:12:56 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:76581 Archived-At: >> 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