From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juanma Barranquero Newsgroups: gmane.emacs.bugs Subject: bug#6740: Spurious byte compiler warnings Date: Wed, 28 Jul 2010 19:56:32 +0200 Message-ID: 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=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1280340473 19504 80.91.229.12 (28 Jul 2010 18:07:53 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 28 Jul 2010 18:07:53 +0000 (UTC) Cc: Dan Nicolaescu , 6740@debbugs.gnu.org To: Alan Mackenzie Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Jul 28 20:07:52 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 1OeB2l-00063n-QF for geb-bug-gnu-emacs@m.gmane.org; Wed, 28 Jul 2010 20:07:52 +0200 Original-Received: from localhost ([127.0.0.1]:47596 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OeB2k-00026C-QW for geb-bug-gnu-emacs@m.gmane.org; Wed, 28 Jul 2010 14:07:50 -0400 Original-Received: from [140.186.70.92] (port=58965 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OeB2e-000262-AG for bug-gnu-emacs@gnu.org; Wed, 28 Jul 2010 14:07:45 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OeB2c-0005Ub-RV for bug-gnu-emacs@gnu.org; Wed, 28 Jul 2010 14:07:44 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:57357) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OeB2c-0005UV-PC for bug-gnu-emacs@gnu.org; Wed, 28 Jul 2010 14:07:42 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1OeAsH-0001lt-PP; Wed, 28 Jul 2010 13:57:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juanma Barranquero 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 17:57: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.12803398056802 (code B ref 6740); Wed, 28 Jul 2010 17:57:01 +0000 Original-Received: (at 6740) by debbugs.gnu.org; 28 Jul 2010 17:56:45 +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 1OeAs0-0001lf-E9 for submit@debbugs.gnu.org; Wed, 28 Jul 2010 13:56:44 -0400 Original-Received: from mail-bw0-f44.google.com ([209.85.214.44]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OeAry-0001la-0t for 6740@debbugs.gnu.org; Wed, 28 Jul 2010 13:56:42 -0400 Original-Received: by bwz7 with SMTP id 7so4457197bwz.3 for <6740@debbugs.gnu.org>; Wed, 28 Jul 2010 10:56:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:received:in-reply-to :references:from:date:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=8GwuLGkw+A9j0eQ0XkbGHzWtPtmT4UhkK9IreHiek3Q=; b=TKaZQepTHQlQQ7HfsJ9ncGHWmKdJdkqHo+ubmpVsrO1Eas31BfDG10Ti5kMnpNxP/6 VpYqE0cuAMgh0rbmd6I/UoJKSENI0nxtVL3f3UW4lpJSrOSjQa+n/DlktOIdmTvpZdFK wC1DiQSon4Lvupah2Vhl9Y91Z8ZxtbKlDjvGw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=gGxXxjkZKrNkl2rBm+PUpuygySKxdLSRZ6SAcjx26/T3ftXsPti7FplC4ZzYqvOe6V A4fe3MClb/RuXTQN2M48q0GsSMqSiS56aCT1ZT+tcPyj1+dUxsapiYc20r0k7R8AB575 vc44bzvITMPpuC5uzZWynuYkNpDbmI3b1OcHc= Original-Received: by 10.204.178.146 with SMTP id bm18mr7762052bkb.99.1280339812134; Wed, 28 Jul 2010 10:56:52 -0700 (PDT) Original-Received: by 10.204.180.136 with HTTP; Wed, 28 Jul 2010 10:56:32 -0700 (PDT) In-Reply-To: <20100728174933.GB2999@muc.de> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Wed, 28 Jul 2010 13:57: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:39028 Archived-At: > But > this discussion is most emphatically NOT about compiled code. =C2=A0It's = about > the process of compiling sources. Warnings do not affect compatibility, so no problem there (though I admit they are ugly). > What use is this warning message? =C2=A0How could it prompt a hacker to > improve his code? =C2=A0(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. > What do you mean by "generic" here? =C2=A0Is 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. > Surely it is a bug that "(featurep 'cc-fix)" appears in the message > rather than "(featurep 'xemacs)". =C2=A0This situation is not about 'cc-f= ix, > it's about 'xemacs. Absolutely no, as shown above. At the point the byte-compiler throws the warning, it does not know (I think) where the relevant nil came from. It is rightly complaining that (featurep 'cc-fix) does nothing and returns a value that goes unused. It would be possible to store the original code before optimization and pass it to the warning generation code, but it is likely not worth it. > Does > anybody actually care about "(featurep 'xemacs)" being optimised away? IIRC, optimizing (featurep 'xemacs) =3D> nil is done, *precisely*, to help compiling portable code. 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. =C2=A0 =C2=A0 Juanma