From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#6740: Spurious byte compiler warnings Date: Wed, 28 Jul 2010 19:45:11 +0000 Message-ID: <20100728194511.GD2999@muc.de> References: <20100727200619.GC2280@muc.de> <20100727212328.GD2280@muc.de> <20100728174933.GB2999@muc.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: dough.gmane.org 1280346799 9872 80.91.229.12 (28 Jul 2010 19:53:19 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 28 Jul 2010 19:53:19 +0000 (UTC) Cc: Dan Nicolaescu , 6740@debbugs.gnu.org To: Juanma Barranquero Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Jul 28 21:53:17 2010 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OeCgn-0001Hp-Ho for geb-bug-gnu-emacs@m.gmane.org; Wed, 28 Jul 2010 21:53:17 +0200 Original-Received: from localhost ([127.0.0.1]:34498 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OeCSU-0006om-Ua for geb-bug-gnu-emacs@m.gmane.org; Wed, 28 Jul 2010 15:38:30 -0400 Original-Received: from [140.186.70.92] (port=34363 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OeCRm-0006K6-J0 for bug-gnu-emacs@gnu.org; Wed, 28 Jul 2010 15:37:47 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OeCRj-0005ig-JW for bug-gnu-emacs@gnu.org; Wed, 28 Jul 2010 15:37:46 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:60069) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OeCRj-0005iY-DZ for bug-gnu-emacs@gnu.org; Wed, 28 Jul 2010 15:37:43 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1OeCO9-0002Rw-Qn; Wed, 28 Jul 2010 15:34:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 28 Jul 2010 19:34:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 6740 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 6740-submit@debbugs.gnu.org id=B6740.12803456359410 (code B ref 6740); Wed, 28 Jul 2010 19:34:01 +0000 Original-Received: (at 6740) by debbugs.gnu.org; 28 Jul 2010 19:33:55 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OeCO2-0002Rj-RX for submit@debbugs.gnu.org; Wed, 28 Jul 2010 15:33:55 -0400 Original-Received: from colin.muc.de ([193.149.48.1] helo=mail.muc.de) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OeCO0-0002Rc-Lx for 6740@debbugs.gnu.org; Wed, 28 Jul 2010 15:33:53 -0400 Original-Received: (qmail 32799 invoked by uid 3782); 28 Jul 2010 19:34:03 -0000 Original-Received: from acm.muc.de (pD9E527D0.dip.t-dialin.net [217.229.39.208]) by colin2.muc.de (tmda-ofmipd) with ESMTP; Wed, 28 Jul 2010 21:34:01 +0200 Original-Received: (qmail 4994 invoked by uid 1000); 28 Jul 2010 19:45:11 -0000 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.9i X-Delivery-Agent: TMDA/1.1.5 (Fettercairn) X-Primary-Address: acm@muc.de X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Wed, 28 Jul 2010 15:34:01 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) 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: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:39031 Archived-At: Hi, Juanma, On Wed, Jul 28, 2010 at 07:56:32PM +0200, Juanma Barranquero wrote: > > What use is this warning message?  How could it prompt a hacker to > > improve his code?  (That's a genuine question, not a rhetorical one.) > It's a warning about non-side-effects code whose result is discarded, > so it obviously prompts the programmer to either check that it didn't > make a mistake (like forgetting to assign the expression's result to a > variable), or remove the code altogether if it is leftover code from a > cut&paste or refactoring. OK, thanks. > > What do you mean by "generic" here?  Is the same trick performed on > > symbols other than 'xemacs? > The warning has *nothing* to do with the xemacs symbol. It would still > be there if you did "(and (not (featurep 'cc-fix)) nil ...)". It just > happens to be triggered, in this particular case, by the byte-compiler > optimizing (featurep 'xemacs) to nil. So the warning is entirely > generic. I'm not any more doubting the correctness of the message; I'm doubting its adequacy. Without understanding that (featurep 'xemacs) has been optimised to nil, it's impossible to understand the current message (either of them). I've spent a long, long time puzzling over this error message. If only there were a warning about 'xemacs, it would be plain and obvious. > > Does anybody actually care about "(featurep 'xemacs)" being optimised > > away? > IIRC, optimizing (featurep 'xemacs) => nil is done, *precisely*, to > help compiling portable code. Misunderstanding, sorry! I'm all in favour of this optimisation being done. But I don't care about it, in the sense I don't want to have to make sense of a confusing message about it. Does anybody care about it enough to want that message in this particular case? Couldn't the optimisation just be done quietly in the background, with no warning? Or couldn't there be a warning like "`(featurep 'xemacs)' has been translated to nil" ? > Because you can have > (if (featurep 'xemacs) > ;; lots of code which would throw warnings or errors on Emacs > ;; because of incompatible parameter profiles and such > ;; else > ;; code for emacs > and compile it without getting warnings of errors in code that will > never be executed on Emacs anyway. OK, I can see that. >     Juanma -- Alan Mackenzie (Nuremberg, Germany).