From debbugs-submit-bounces@debbugs.gnu.org Sat Jul 09 10:34:27 2011 Received: (at submit) by debbugs.gnu.org; 9 Jul 2011 14:34:28 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QfYbz-0001ge-IZ for submit@debbugs.gnu.org; Sat, 09 Jul 2011 10:34:27 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QfYbx-0001gQ-32 for submit@debbugs.gnu.org; Sat, 09 Jul 2011 10:34:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QfYbq-0003yK-Cg for submit@debbugs.gnu.org; Sat, 09 Jul 2011 10:34:19 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_MED,T_RP_MATCHES_RCVD,T_TO_NO_BRKTS_FREEMAIL autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([140.186.70.17]:35251) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QfYbq-0003yG-5T for submit@debbugs.gnu.org; Sat, 09 Jul 2011 10:34:18 -0400 Received: from eggs.gnu.org ([140.186.70.92]:60704) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QfYbo-00018K-Rf for bug-gnu-emacs@gnu.org; Sat, 09 Jul 2011 10:34:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QfYbn-0003y6-H1 for bug-gnu-emacs@gnu.org; Sat, 09 Jul 2011 10:34:16 -0400 Received: from treacle.ucs.ed.ac.uk ([129.215.16.102]:56910) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QfYbj-0003xW-1C for bug-gnu-emacs@gnu.org; Sat, 09 Jul 2011 10:34:15 -0400 Received: from lmtp1.ucs.ed.ac.uk (lmtp1.ucs.ed.ac.uk [129.215.149.64]) by treacle.ucs.ed.ac.uk (8.13.8/8.13.4) with ESMTP id p69EXqW5018341 for ; Sat, 9 Jul 2011 15:33:57 +0100 (BST) Received: from e4300lm (02d8b348.bb.sky.com [2.216.179.72]) (authenticated user=lmitche4 mech=PLAIN bits=0) by lmtp1.ucs.ed.ac.uk (8.13.8/8.13.7) with ESMTP id p69EXoho025553 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT) for ; Sat, 9 Jul 2011 15:33:51 +0100 (BST) From: Lawrence Mitchell To: bug-gnu-emacs@gnu.org Subject: 24.0.50; byte-compiler warnings with defstruct and lexical-binding Date: Sat, 09 Jul 2011 14:10:08 +0100 Message-ID: <871uxz7eu2.fsf@ed.ac.uk> MIME-Version: 1.0 Content-Type: text/plain X-Edinburgh-Scanned: at treacle.ucs.ed.ac.uk with MIMEDefang 2.60, Sophie, Sophos Anti-Virus, Clam AntiVirus X-Scanned-By: MIMEDefang 2.60 on 129.215.16.102 X-Scanned-By: MIMEDefang 2.52 on 129.215.149.64 X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.17 X-Spam-Score: -6.6 (------) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.6 (------) In files with lexical-binding set to t, structure definitions with :read-only slots lead to a byte-compiler warning about the unused variable cl-x. To reproduce, byte-compile a file consisting of: ;; -*- lexical-binding: t -*- (eval-when-compile (require 'cl)) (defstruct foo (name nil :read-only t)) This is due to the setf-method that is produced when expanding the defstruct form: (define-setf-method ... (cl-x) (error (format "%s is a read-only slot" ...))) The following patch fixes the problem by changing the setf-method to: (define-setf-method ... (cl-x) (progn (ignore cl-x) (error (format "%s is a read-only slot" ...)))) Commit message/changelog entry Silence byte-compiler warning with :read-only defstruct slots * emacs-lisp/cl-macs.el (defstruct): Ignore argument to setf method if slot is read-only. Patch: diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index 2813cc4..6181c6b 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el @@ -2389,8 +2389,10 @@ value, that slot cannot be set via `setf'. (push (cons accessor t) side-eff) (push (list 'define-setf-method accessor '(cl-x) (if (cadr (memq :read-only (cddr desc))) - (list 'error (format "%s is a read-only slot" - accessor)) + (list 'progn '(ignore cl-x) + (list 'error + (format "%s is a read-only slot" + 'accessor))) ;; If cl is loaded only for compilation, ;; the call to cl-struct-setf-expander would ;; cause a warning because it may not be From debbugs-submit-bounces@debbugs.gnu.org Sat Jul 16 11:53:58 2011 Received: (at 9035) by debbugs.gnu.org; 16 Jul 2011 15:53:58 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Qi7Bm-00041H-0T for submit@debbugs.gnu.org; Sat, 16 Jul 2011 11:53:58 -0400 Received: from hermes.netfonds.no ([80.91.224.195]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Qi7Bk-000410-4Y for 9035@debbugs.gnu.org; Sat, 16 Jul 2011 11:53:56 -0400 Received: from cm-84.215.51.58.getinternet.no ([84.215.51.58] helo=quimbies.gnus.org) by hermes.netfonds.no with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1Qi7BY-0001P7-Rc; Sat, 16 Jul 2011 17:53:44 +0200 From: Lars Magne Ingebrigtsen To: Lawrence Mitchell Subject: Re: 24.0.50; byte-compiler warnings with defstruct and lexical-binding In-Reply-To: <871uxz7eu2.fsf@ed.ac.uk> (Lawrence Mitchell's message of "Sat, 09 Jul 2011 14:10:08 +0100") Date: Sat, 16 Jul 2011 17:53:29 +0200 Message-ID: References: <871uxz7eu2.fsf@ed.ac.uk> User-Agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.50 (gnu/linux) X-Now-Playing: Joni Mitchell's _Taming the Tiger_: "Love Puts on a New Face" X-Hashcash: 1:23:110716:wence@gmx.li::iqee4BrWmttTezGr:00000hmgV X-Hashcash: 1:23:110716:9035@debbugs.gnu.org::Gdcsca7XD8Xs/VqJ:00000000000000000000000000000000000000000TTY5 MIME-Version: 1.0 Content-Type: text/plain X-MailScanner-ID: 1Qi7BY-0001P7-Rc X-Netfonds-MailScanner: Found to be clean X-Netfonds-MailScanner-From: larsi@gnus.org MailScanner-NULL-Check: 1311436424.99743@JHd7idhAAlq/OTBgNMXM7Q X-Spam-Status: No X-Spam-Score: -2.7 (--) X-Debbugs-Envelope-To: 9035 Cc: 9035@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.7 (--) Lawrence Mitchell writes: > The following patch fixes the problem by changing the setf-method > to: > > (define-setf-method ... (cl-x) > (progn (ignore cl-x) > (error (format "%s is a read-only slot" ...)))) Thanks; I've applied this to Emacs 24. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog http://lars.ingebrigtsen.no/ From debbugs-submit-bounces@debbugs.gnu.org Sat Jul 16 11:53:44 2011 Received: (at control) by debbugs.gnu.org; 16 Jul 2011 15:53:44 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Qi7BY-00040n-Dl for submit@debbugs.gnu.org; Sat, 16 Jul 2011 11:53:44 -0400 Received: from hermes.netfonds.no ([80.91.224.195]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Qi7BW-00040c-UU for control@debbugs.gnu.org; Sat, 16 Jul 2011 11:53:43 -0400 Received: from cm-84.215.51.58.getinternet.no ([84.215.51.58] helo=quimbies.gnus.org) by hermes.netfonds.no with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1Qi7BM-0001Ok-5E for control@debbugs.gnu.org; Sat, 16 Jul 2011 17:53:32 +0200 Date: Sat, 16 Jul 2011 17:53:31 +0200 Message-Id: To: control@debbugs.gnu.org From: Lars Magne Ingebrigtsen Subject: control message for bug #9035 X-MailScanner-ID: 1Qi7BM-0001Ok-5E X-Netfonds-MailScanner: Found to be clean X-Netfonds-MailScanner-From: larsi@gnus.org MailScanner-NULL-Check: 1311436412.31238@fmhtcRxaUYAAdy38/FmlHQ X-Spam-Status: No X-Spam-Score: -2.7 (--) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.7 (--) tags 9035 fixed close 9035 24.1 From unknown Sun Jun 15 10:54:15 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sun, 14 Aug 2011 11:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator