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#15416: Unused lexical argument warnings not optimized away in featurep 'xemacs Date: Thu, 19 Sep 2013 09:55:22 -0400 Message-ID: References: <7szjr95xt6.fsf@fencepost.gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1379598987 25606 80.91.229.3 (19 Sep 2013 13:56:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 19 Sep 2013 13:56:27 +0000 (UTC) Cc: 15416@debbugs.gnu.org To: Glenn Morris Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Sep 19 15:56:29 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 1VMeiX-0002JX-7f for geb-bug-gnu-emacs@m.gmane.org; Thu, 19 Sep 2013 15:56:25 +0200 Original-Received: from localhost ([::1]:51314 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VMeiW-00041B-Ud for geb-bug-gnu-emacs@m.gmane.org; Thu, 19 Sep 2013 09:56:24 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37328) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VMeiM-0003zw-Hl for bug-gnu-emacs@gnu.org; Thu, 19 Sep 2013 09:56:22 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VMeiB-00055A-W0 for bug-gnu-emacs@gnu.org; Thu, 19 Sep 2013 09:56:14 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:40523) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VMeiB-000556-T0 for bug-gnu-emacs@gnu.org; Thu, 19 Sep 2013 09:56:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1VMeiA-00011S-Gf for bug-gnu-emacs@gnu.org; Thu, 19 Sep 2013 09:56:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 19 Sep 2013 13:56:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15416 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 15416-submit@debbugs.gnu.org id=B15416.13795989283795 (code B ref 15416); Thu, 19 Sep 2013 13:56:02 +0000 Original-Received: (at 15416) by debbugs.gnu.org; 19 Sep 2013 13:55:28 +0000 Original-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 Original-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 Original-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 Original-Received: by faina.iro.umontreal.ca (Postfix, from userid 20848) id 7881BB40D3; Thu, 19 Sep 2013 09:55:22 -0400 (EDT) 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) 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-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:78575 Archived-At: > ; -*- 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