From debbugs-submit-bounces@debbugs.gnu.org Wed Sep 18 22:51:06 2013 Received: (at submit) by debbugs.gnu.org; 19 Sep 2013 02:51:06 +0000 Received: from localhost ([127.0.0.1]:47912 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VMUKg-000055-E6 for submit@debbugs.gnu.org; Wed, 18 Sep 2013 22:51:06 -0400 Received: from fencepost.gnu.org ([208.118.235.10]:48769 ident=Debian-exim) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VMUKd-00004v-CP for submit@debbugs.gnu.org; Wed, 18 Sep 2013 22:51:03 -0400 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1VMUKc-0001oe-71; Wed, 18 Sep 2013 22:51:02 -0400 From: Glenn Morris To: submit@debbugs.gnu.org Subject: Unused lexical argument warnings not optimized away in featurep 'xemacs X-Spook: United Nations Delta Force Fedayeen munitions pink noise X-Ran: I%N7=V^$Zec\)mCWs*&#mfeJ@lu[b5-qIC=q!XD(3i?(o)*{v"f@LOzUL7dl[Qp8n|->6J X-Hue: white X-Debbugs-No-Ack: yes X-Attribution: GM Date: Wed, 18 Sep 2013 22:51:01 -0400 Message-ID: <7szjr95xt6.fsf@fencepost.gnu.org> User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -5.7 (-----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.7 (-----) Package: emacs Version: 24.3.50 Severity: minor Byte-compiling this: ; -*- lexical-binding: t -*- (if (featurep 'xemacs) (defun foo (blah) )) gives: foo.el:2:1:Warning: Unused lexical argument `blah' I thought code inside "(if (featurep 'xemacs)" was supposed to be optimized away by the compiler? From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 19 09:55:28 2013 Received: (at 15416) by debbugs.gnu.org; 19 Sep 2013 13:55:28 +0000 Received: from localhost ([127.0.0.1]:48704 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VMehb-0000z7-2Y for submit@debbugs.gnu.org; Thu, 19 Sep 2013 09:55:27 -0400 Received: from chene.dit.umontreal.ca ([132.204.246.20]:56715) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VMehX-0000yt-LF for 15416@debbugs.gnu.org; Thu, 19 Sep 2013 09:55:24 -0400 Received: from faina.iro.umontreal.ca (lechon.iro.umontreal.ca [132.204.27.242]) by chene.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id r8JDtMBR005951; Thu, 19 Sep 2013 09:55:22 -0400 Received: by faina.iro.umontreal.ca (Postfix, from userid 20848) id 7881BB40D3; Thu, 19 Sep 2013 09:55:22 -0400 (EDT) From: Stefan Monnier To: Glenn Morris Subject: Re: bug#15416: Unused lexical argument warnings not optimized away in featurep 'xemacs Message-ID: References: <7szjr95xt6.fsf@fencepost.gnu.org> Date: Thu, 19 Sep 2013 09:55:22 -0400 In-Reply-To: <7szjr95xt6.fsf@fencepost.gnu.org> (Glenn Morris's message of "Wed, 18 Sep 2013 22:51:01 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV4706=0 X-NAI-Spam-Version: 2.3.0.9362 : core <4706> : inlines <95> : streams <1040863> : uri <1541415> X-Spam-Score: -2.0 (--) X-Debbugs-Envelope-To: 15416 Cc: 15416@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.0 (--) > ; -*- lexical-binding: t -*- > (if (featurep 'xemacs) > (defun foo (blah) > )) > gives: > foo.el:2:1:Warning: Unused lexical argument `blah' > I thought code inside "(if (featurep 'xemacs)" was supposed to be > optimized away by the compiler? It is optimized away later. The reason it is done later is ironically to avoid such "unused arg" warnings in code like (defun f (a b) (if (featurep 'xemacs) (foo a b) (bar a))) It is important for the warnings to relate as much as possible to the actual source code rather than to its optimized form, otherwise you can have warnings that are hard/impossible to fix. E.g. (let ((x '(a b c d e g))) (bla x x x)) could complain "unused var x" because the optimizer replaced each use of `x' with the corresponding constant. Every failure to follow this principle leads to annoyances. Witness the "unused lexical argument err" warnings for (condition-case err (scan-error nil) (error (message "%S" err))) and similar problems with some macros. Stefan From debbugs-submit-bounces@debbugs.gnu.org Thu Sep 19 12:20:06 2013 Received: (at control) by debbugs.gnu.org; 19 Sep 2013 16:20:06 +0000 Received: from localhost ([127.0.0.1]:49469 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VMgxY-0004hk-IN for submit@debbugs.gnu.org; Thu, 19 Sep 2013 12:20:05 -0400 Received: from fencepost.gnu.org ([208.118.235.10]:60535 ident=Debian-exim) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VMgxS-0004hE-CI for control@debbugs.gnu.org; Thu, 19 Sep 2013 12:20:01 -0400 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1VMgxR-0005wP-V2 for control@debbugs.gnu.org; Thu, 19 Sep 2013 12:19:58 -0400 Date: Thu, 19 Sep 2013 12:19:57 -0400 Message-Id: Subject: control message for bug 15416 To: X-Mailer: mail (GNU Mailutils 2.1) From: Glenn Morris X-Spam-Score: -5.7 (-----) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.7 (-----) tag 15416 wontfix close 15416 From unknown Tue Jun 24 19:10:34 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Fri, 18 Oct 2013 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