GNU bug report logs - #6740
Spurious byte compiler warnings

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Severity: minor; Reported by: Alan Mackenzie <acm@HIDDEN>; dated Tue, 27 Jul 2010 19:56:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 6740 <at> debbugs.gnu.org:


Received: (at 6740) by debbugs.gnu.org; 29 Jul 2010 20:36:32 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jul 29 16:36:32 2010
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1OeZqB-0006X9-Ey
	for submit <at> debbugs.gnu.org; Thu, 29 Jul 2010 16:36:31 -0400
Received: from mail-bw0-f44.google.com ([209.85.214.44])
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <lekktu@HIDDEN>) id 1OeZq9-0006X4-SO
	for 6740 <at> debbugs.gnu.org; Thu, 29 Jul 2010 16:36:30 -0400
Received: by bwz7 with SMTP id 7so489524bwz.3
	for <6740 <at> debbugs.gnu.org>; Thu, 29 Jul 2010 13:36:43 -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=/U2CGrPi7cVwjj2HLu3o0khKMI1voUIhVRJc2CK4yYw=;
	b=ppr75RUBJtj+foUehMPUtpdnkdY2rcRFHbcoIAsckCDUDxNd6snj/wN1ucPNPlU6RM
	/ipZl3UclBNalLlmJ8Qsz4/63do2gHvYehegg+ttNFejRAcFmfsUvo8hbC2NuXgUgQNH
	P3CcEfIG+aNKOOLeKT3wS3UsXm0DO3NecK+9o=
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=OCSah8oOayMEoI6EPM0WGjs1A54o5jZ/qXUPkRreseFW+rIG7MYXBagEjJtxFiN9OC
	8uWTV88uwzEYBZanmJF4PE+f31nYCb+PEwOVPovRixIRbFkCEOxdYZ1ziw9pASxxUESb
	0YEcK2Qkne1NR8fRwlLZMcGx5lzqE2sknNOCo=
Received: by 10.204.76.205 with SMTP id d13mr448098bkk.93.1280435803257; Thu, 
	29 Jul 2010 13:36:43 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.204.180.136 with HTTP; Thu, 29 Jul 2010 13:36:23 -0700 (PDT)
In-Reply-To: <20100729202420.GB2459@HIDDEN>
References: <20100727200619.GC2280@HIDDEN> <yxqmxtcwu1w.fsf@HIDDEN>
	<20100727212328.GD2280@HIDDEN>
	<AANLkTikdVKf70_nbaBbYPyjUE7iRZ1RXX8ybFJEvaXQe@HIDDEN> 
	<20100728174933.GB2999@HIDDEN>
	<AANLkTinL9pYA-yg2kOvD_N0+jVX+=uJcoVbBCvQ_qN87@HIDDEN> 
	<20100728194511.GD2999@HIDDEN>
	<AANLkTinPrue70-0fO0Z+S=594dok0CmzZfo5WKgf22xg@HIDDEN> 
	<20100729202420.GB2459@HIDDEN>
From: Juanma Barranquero <lekktu@HIDDEN>
Date: Thu, 29 Jul 2010 22:36:23 +0200
Message-ID: <AANLkTik4xbU23rhOKqcunf3T+_k9-CygthVM3SzN191v@HIDDEN>
Subject: Re: bug#6740: Spurious byte compiler warnings
To: Alan Mackenzie <acm@HIDDEN>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -2.7 (--)
X-Debbugs-Envelope-To: 6740
Cc: Dan Nicolaescu <dann@HIDDEN>, 6740 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/pipermail/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -2.7 (--)

On Thu, Jul 29, 2010 at 22:24, Alan Mackenzie <acm@HIDDEN> wrote:

> No, sorry it isn't. =C2=A0It's a good hint that there's a bug in the byte
> compiler, the tentative conclusion I came to after trying various things.

No, of course not, because there's no bug (well, other than the
duplicate message).

The warning is obscure, yes. Warnings about optimized code often are.
I agree that it'd be good to have better warnings and error messages
(something like "optimization X has rendered code Y unused", perhaps).
IIRC, there's published research about good error messages in the face
of program transformations.

> If it were such a good hint, I wouldn't have spent several hours of
> bafflement trying to figure out what was wrong. =C2=A0Or is it just me wh=
o's
> uniquely stupid?

It's not about being stupid, only about knowing a bit what the
bytecompiler does, or not. You didn't, and you're *right* that the
warning is difficult to interpret.

> Is there anybody here listening in who's seen this
> message and immediately understood it?

Well, I did, but I remembered the (featurep 'xemacs) optimization so I
had a head start.

> Abstractly seen, the warning did not relate to my source code; it related
> to an internal, transformed, different piece of source created by the
> compiler. =C2=A0I think warning messages should always be wrt the origina=
l
> code.

Agreed.

> The cause of my confusion was that silent change to 'xemacs.
> There are surely not too many situations where the compiler does this,
> are there?

Even if there aren't many, optimizations could be added later; for
example, to statically determine that (=3D 0 0) is t, or even that (and
(> x 0) (< x 0)) is nil.

> Yes; I've already made that change, thanks! =C2=A0But what is the process=
 by
> which I'm meant to come to sufficient understanding to be able figure
> this out?

That's a good question.

> There's nothing suspicious about having (featurep 'xemacs) in the middle
> of an `and' form.

No, but the warning isn't about that. Is about unused side-effect-free code=
.

> I agree there would be something suspicious about
> having a bare `nil' there. =C2=A0Can't the compiler figure out the differ=
ence
> between these two cases somehow?

Yes, it could. Again, no one has bothered to implement it, because
these kinds of problems aren't common (most warnings are relatively
understandable withouth delving into the bytecompiler sources).

> Oh, all right then. =C2=A0Can I ask you to come up with some form of warn=
ing
> which, several years ago, would have saved me all these hours of
> frustration?

Not me. I understand what the bytecompiler is doing (at least, I think
I do) but I'll leave fixing it for the experts.

=C2=A0 =C2=A0 Juanma




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs@HIDDEN:
bug#6740; Package emacs. Full text available.

Message received at 6740 <at> debbugs.gnu.org:


Received: (at 6740) by debbugs.gnu.org; 29 Jul 2010 20:13:03 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jul 29 16:13:01 2010
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1OeZTR-0006MQ-LH
	for submit <at> debbugs.gnu.org; Thu, 29 Jul 2010 16:13:01 -0400
Received: from colin.muc.de ([193.149.48.1] helo=mail.muc.de)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <acm@HIDDEN>) id 1OeZTO-0006MK-8e
	for 6740 <at> debbugs.gnu.org; Thu, 29 Jul 2010 16:12:59 -0400
Received: (qmail 9692 invoked by uid 3782); 29 Jul 2010 20:13:11 -0000
Received: from acm.muc.de (pD9E530D8.dip.t-dialin.net [217.229.48.216]) by
	colin2.muc.de (tmda-ofmipd) with ESMTP;
	Thu, 29 Jul 2010 22:13:09 +0200
Received: (qmail 4002 invoked by uid 1000); 29 Jul 2010 20:24:20 -0000
Date: Thu, 29 Jul 2010 20:24:20 +0000
To: Juanma Barranquero <lekktu@HIDDEN>
Subject: Re: bug#6740: Spurious byte compiler warnings
Message-ID: <20100729202420.GB2459@HIDDEN>
References: <20100727200619.GC2280@HIDDEN> <yxqmxtcwu1w.fsf@HIDDEN>
	<20100727212328.GD2280@HIDDEN>
	<AANLkTikdVKf70_nbaBbYPyjUE7iRZ1RXX8ybFJEvaXQe@HIDDEN>
	<20100728174933.GB2999@HIDDEN>
	<AANLkTinL9pYA-yg2kOvD_N0+jVX+=uJcoVbBCvQ_qN87@HIDDEN>
	<20100728194511.GD2999@HIDDEN>
	<AANLkTinPrue70-0fO0Z+S=594dok0CmzZfo5WKgf22xg@HIDDEN>
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <AANLkTinPrue70-0fO0Z+S=594dok0CmzZfo5WKgf22xg@HIDDEN>
User-Agent: Mutt/1.5.9i
X-Delivery-Agent: TMDA/1.1.5 (Fettercairn)
From: Alan Mackenzie <acm@HIDDEN>
X-Primary-Address: acm@HIDDEN
X-Spam-Score: -1.7 (-)
X-Debbugs-Envelope-To: 6740
Cc: Dan Nicolaescu <dann@HIDDEN>, 6740 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/pipermail/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -2.6 (--)

Hi, Juanma,

On Wed, Jul 28, 2010 at 09:54:04PM +0200, Juanma Barranquero wrote:
> On Wed, Jul 28, 2010 at 21:45, Alan Mackenzie <acm@HIDDEN> wrote:

> > I'm doubting its adequacy.  Without understanding that (featurep
> > 'xemacs) has been optimised to nil, it's impossible to understand the
> > current message

> I think the message is a good hint that something is being statically
> determined to be nil inside an `and'.

No, sorry it isn't.  It's a good hint that there's a bug in the byte
compiler, the tentative conclusion I came to after trying various things.
If it were such a good hint, I wouldn't have spent several hours of
bafflement trying to figure out what was wrong.  Or is it just me who's
uniquely stupid?  Is there anybody here listening in who's seen this
message and immediately understood it?

Abstractly seen, the warning did not relate to my source code; it related
to an internal, transformed, different piece of source created by the
compiler.  I think warning messages should always be wrt the original
code.


> > If only there were a warning about 'xemacs, it would be plain and
> > obvious.

> But, as I've explained, there cannot (easily) be a warning about
> `xemacs'; it would have to be about any code that statically evaluates
> to nil in such a context.

No.  It would be about code which the _compiler_ had transformed to a
static nil.  The cause of my confusion was that silent change to 'xemacs.
There are surely not too many situations where the compiler does this,
are there?

> I'm not sure how clean that would be to implement, and anyway no one
> has been bothered enough to try it.

:-)  I know nothing of the byte compiler, but maybe I'll give it a go
sometime.

> > Does anybody care about it enough to want that message in this
> > particular case?

> Yes. You don't know whether a warning is relevant or not unless you
> get it. In *this* particular case, all you need to quiet the
> byte-compiler is

> @@ -1,5 +1,5 @@
>  (eval-when-compile
> -  (if (and (not (featurep 'cc-fix))
> -          (featurep 'xemacs)
> +  (if (and (featurep 'xemacs)
> +          (not (featurep 'cc-fix))
>             (progn
>               (require 'font-lock)

Yes; I've already made that change, thanks!  But what is the process by
which I'm meant to come to sufficient understanding to be able figure
this out?

> > Couldn't the optimisation just be done quietly in the background,
> > with no warning?

> Why? The optimization is detecting something suspicious, and acting
> accordingly.

There's nothing suspicious about having (featurep 'xemacs) in the middle
of an `and' form.  I agree there would be something suspicious about
having a bare `nil' there.  Can't the compiler figure out the difference
between these two cases somehow?

> > Or couldn't there be a warning like

> >    "`(featurep 'xemacs)' has been translated to nil"

> ????

> That's worse that what you're complaining now; every use of (featurep
> 'xemacs) in the sources would produce warnings!

Oh, all right then.  Can I ask you to come up with some form of warning
which, several years ago, would have saved me all these hours of
frustration?


>     Juanma

-- 
Alan Mackenzie (Nuremberg, Germany).




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs@HIDDEN:
bug#6740; Package emacs. Full text available.

Message received at 6740 <at> debbugs.gnu.org:


Received: (at 6740) by debbugs.gnu.org; 28 Jul 2010 23:00:02 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jul 28 19:00:02 2010
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1OeFbV-0003sw-T5
	for submit <at> debbugs.gnu.org; Wed, 28 Jul 2010 19:00:02 -0400
Received: from fencepost.gnu.org ([140.186.70.10])
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <dann@HIDDEN>) id 1OeFbU-0003sY-22
	for 6740 <at> debbugs.gnu.org; Wed, 28 Jul 2010 19:00:00 -0400
Received: from dann by fencepost.gnu.org with local (Exim 4.69)
	(envelope-from <dann@HIDDEN>)
	id 1OeFbf-000697-A0; Wed, 28 Jul 2010 19:00:11 -0400
To: Juanma Barranquero <lekktu@HIDDEN>
Subject: Re: bug#6740: Spurious byte compiler warnings
References: <20100727200619.GC2280@HIDDEN> <yxqmxtcwu1w.fsf@HIDDEN>
	<20100727212328.GD2280@HIDDEN>
	<AANLkTikdVKf70_nbaBbYPyjUE7iRZ1RXX8ybFJEvaXQe@HIDDEN>
	<20100728174933.GB2999@HIDDEN>
	<AANLkTinL9pYA-yg2kOvD_N0+jVX+=uJcoVbBCvQ_qN87@HIDDEN>
	<20100728194511.GD2999@HIDDEN>
	<AANLkTinPrue70-0fO0Z+S=594dok0CmzZfo5WKgf22xg@HIDDEN>
From: Dan Nicolaescu <dann@HIDDEN>
Date: Wed, 28 Jul 2010 19:00:11 -0400
In-Reply-To: <AANLkTinPrue70-0fO0Z+S=594dok0CmzZfo5WKgf22xg@HIDDEN>
	(Juanma Barranquero's message of "Wed\,
	28 Jul 2010 21\:54\:04 +0200")
Message-ID: <yxqfwz3tdok.fsf@HIDDEN>
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -6.5 (------)
X-Debbugs-Envelope-To: 6740
Cc: Alan Mackenzie <acm@HIDDEN>, 6740 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/pipermail/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -6.5 (------)

Juanma Barranquero <lekktu@HIDDEN> writes:

> On Wed, Jul 28, 2010 at 21:45, Alan Mackenzie <acm@HIDDEN> wrote:
>
>>
>> =A0 =A0"`(featurep 'xemacs)' has been translated to nil"
>
> ????
>
> That's worse that what you're complaining now; every use of (featurep
> 'xemacs) in the sources would produce warnings!

Exactly, and it would defeat the purpose of optimizing away=20
(featurp 'xemacs) (and (featurep 'emacs): being able to have a single sourc=
e base that=20
works on both platforms, and it can be compiled warning free.




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs@HIDDEN:
bug#6740; Package emacs. Full text available.

Message received at 6740 <at> debbugs.gnu.org:


Received: (at 6740) by debbugs.gnu.org; 28 Jul 2010 19:54:16 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jul 28 15:54:15 2010
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1OeChj-0002Zk-DY
	for submit <at> debbugs.gnu.org; Wed, 28 Jul 2010 15:54:15 -0400
Received: from mail-bw0-f44.google.com ([209.85.214.44])
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <lekktu@HIDDEN>) id 1OeChh-0002Zf-K8
	for 6740 <at> debbugs.gnu.org; Wed, 28 Jul 2010 15:54:14 -0400
Received: by bwz7 with SMTP id 7so4507779bwz.3
	for <6740 <at> debbugs.gnu.org>; Wed, 28 Jul 2010 12:54:24 -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=3Hd+Bs5vcXIT4ostSxt/UfITloAD54NoZhjEzvfzioQ=;
	b=f5C3rylEj5aYpBHV3gZtDT0J72f4IG2ErZwdNZdMwCLrvhldjBQ8UMAvIIdesOG6hf
	ofOdrm3QeFxcX0spkPmEG51b6Hgg30pZ/Qk1DlUSzaCxovBpIOhIv5cqgPAvv0g96TeZ
	eWgMiGyyzy29QX18+l1Lp9ThepxJSyU1g/b8s=
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=pUgiFOHay6IcLH9d5qz7gKcTwLdGNXKWlWD0M3QF5pecDLP7D0pZJdG0NBl0e2HU/5
	P/xMZ81TfVfKiBhk9uM8QzcPIhD5NRMAH079hHJkaiCOZRV/qav3cgYaHOC3bIRCC2t4
	Q6q2dsF0F60bAHHJN+SbL9knQ/5H2zdECskFo=
Received: by 10.204.73.211 with SMTP id r19mr8044191bkj.131.1280346864209; 
	Wed, 28 Jul 2010 12:54:24 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.204.180.136 with HTTP; Wed, 28 Jul 2010 12:54:04 -0700 (PDT)
In-Reply-To: <20100728194511.GD2999@HIDDEN>
References: <20100727200619.GC2280@HIDDEN> <yxqmxtcwu1w.fsf@HIDDEN>
	<20100727212328.GD2280@HIDDEN>
	<AANLkTikdVKf70_nbaBbYPyjUE7iRZ1RXX8ybFJEvaXQe@HIDDEN> 
	<20100728174933.GB2999@HIDDEN>
	<AANLkTinL9pYA-yg2kOvD_N0+jVX+=uJcoVbBCvQ_qN87@HIDDEN> 
	<20100728194511.GD2999@HIDDEN>
From: Juanma Barranquero <lekktu@HIDDEN>
Date: Wed, 28 Jul 2010 21:54:04 +0200
Message-ID: <AANLkTinPrue70-0fO0Z+S=594dok0CmzZfo5WKgf22xg@HIDDEN>
Subject: Re: bug#6740: Spurious byte compiler warnings
To: Alan Mackenzie <acm@HIDDEN>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -2.7 (--)
X-Debbugs-Envelope-To: 6740
Cc: Dan Nicolaescu <dann@HIDDEN>, 6740 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/pipermail/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -2.7 (--)

On Wed, Jul 28, 2010 at 21:45, Alan Mackenzie <acm@HIDDEN> wrote:

> I'm doubting
> its adequacy. =C2=A0Without understanding that (featurep 'xemacs) has bee=
n
> optimised to nil, it's impossible to understand the current message

I think the message is a good hint that something is being statically
determined to be nil inside an `and'.

> (either of them).

Yes, that's a bug :-)

> If only there were a warning about 'xemacs, it would be plain
> and obvious.

But, as I've explained, there cannot (easily) be a waning about
`xemacs'; it would have to be about any code that statically evaluates
to nil in such a context. I'm not sure how clean that would be to
implement, and anyway no one has been bothered enough to try it.

> Does anybody care about
> it enough to want that message in this particular case?

Yes. You don't know whether a warning is relevant or not unless you
get it. In *this* particular case, all you need to quiet the
byte-compiler is

@@ -1,5 +1,5 @@
 (eval-when-compile
-  (if (and (not (featurep 'cc-fix))
-          (featurep 'xemacs)
+  (if (and (featurep 'xemacs)
+          (not (featurep 'cc-fix))
            (progn
              (require 'font-lock)


> Couldn't the
> optimisation just be done quietly in the background, with no warning?

Why? The optimization is detecting something suspicious, and acting
accordingly.

> Or couldn't there be a warning like
>
> =C2=A0 =C2=A0"`(featurep 'xemacs)' has been translated to nil"

????

That's worse that what you're complaining now; every use of (featurep
'xemacs) in the sources would produce warnings!

=C2=A0 =C2=A0 Juanma




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs@HIDDEN:
bug#6740; Package emacs. Full text available.

Message received at 6740 <at> debbugs.gnu.org:


Received: (at 6740) by debbugs.gnu.org; 28 Jul 2010 19:33:55 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jul 28 15:33:55 2010
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1OeCO2-0002Rj-RX
	for submit <at> debbugs.gnu.org; Wed, 28 Jul 2010 15:33:55 -0400
Received: from colin.muc.de ([193.149.48.1] helo=mail.muc.de)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <acm@HIDDEN>) id 1OeCO0-0002Rc-Lx
	for 6740 <at> debbugs.gnu.org; Wed, 28 Jul 2010 15:33:53 -0400
Received: (qmail 32799 invoked by uid 3782); 28 Jul 2010 19:34:03 -0000
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
Received: (qmail 4994 invoked by uid 1000); 28 Jul 2010 19:45:11 -0000
Date: Wed, 28 Jul 2010 19:45:11 +0000
To: Juanma Barranquero <lekktu@HIDDEN>
Subject: Re: bug#6740: Spurious byte compiler warnings
Message-ID: <20100728194511.GD2999@HIDDEN>
References: <20100727200619.GC2280@HIDDEN> <yxqmxtcwu1w.fsf@HIDDEN>
	<20100727212328.GD2280@HIDDEN>
	<AANLkTikdVKf70_nbaBbYPyjUE7iRZ1RXX8ybFJEvaXQe@HIDDEN>
	<20100728174933.GB2999@HIDDEN>
	<AANLkTinL9pYA-yg2kOvD_N0+jVX+=uJcoVbBCvQ_qN87@HIDDEN>
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <AANLkTinL9pYA-yg2kOvD_N0+jVX+=uJcoVbBCvQ_qN87@HIDDEN>
User-Agent: Mutt/1.5.9i
X-Delivery-Agent: TMDA/1.1.5 (Fettercairn)
From: Alan Mackenzie <acm@HIDDEN>
X-Primary-Address: acm@HIDDEN
X-Spam-Score: -2.6 (--)
X-Debbugs-Envelope-To: 6740
Cc: Dan Nicolaescu <dann@HIDDEN>, 6740 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/pipermail/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -2.6 (--)

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).




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs@HIDDEN:
bug#6740; Package emacs. Full text available.

Message received at 6740 <at> debbugs.gnu.org:


Received: (at 6740) by debbugs.gnu.org; 28 Jul 2010 17:56:45 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jul 28 13:56:44 2010
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1OeAs0-0001lf-E9
	for submit <at> debbugs.gnu.org; Wed, 28 Jul 2010 13:56:44 -0400
Received: from mail-bw0-f44.google.com ([209.85.214.44])
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <lekktu@HIDDEN>) id 1OeAry-0001la-0t
	for 6740 <at> debbugs.gnu.org; Wed, 28 Jul 2010 13:56:42 -0400
Received: by bwz7 with SMTP id 7so4457197bwz.3
	for <6740 <at> 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=
Received: by 10.204.178.146 with SMTP id bm18mr7762052bkb.99.1280339812134; 
	Wed, 28 Jul 2010 10:56:52 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.204.180.136 with HTTP; Wed, 28 Jul 2010 10:56:32 -0700 (PDT)
In-Reply-To: <20100728174933.GB2999@HIDDEN>
References: <20100727200619.GC2280@HIDDEN> <yxqmxtcwu1w.fsf@HIDDEN>
	<20100727212328.GD2280@HIDDEN>
	<AANLkTikdVKf70_nbaBbYPyjUE7iRZ1RXX8ybFJEvaXQe@HIDDEN> 
	<20100728174933.GB2999@HIDDEN>
From: Juanma Barranquero <lekktu@HIDDEN>
Date: Wed, 28 Jul 2010 19:56:32 +0200
Message-ID: <AANLkTinL9pYA-yg2kOvD_N0+jVX+=uJcoVbBCvQ_qN87@HIDDEN>
Subject: Re: bug#6740: Spurious byte compiler warnings
To: Alan Mackenzie <acm@HIDDEN>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -2.0 (--)
X-Debbugs-Envelope-To: 6740
Cc: Dan Nicolaescu <dann@HIDDEN>, 6740 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/pipermail/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -2.7 (--)

> 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




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs@HIDDEN:
bug#6740; Package emacs. Full text available.

Message received at 6740 <at> debbugs.gnu.org:


Received: (at 6740) by debbugs.gnu.org; 28 Jul 2010 17:38:18 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jul 28 13:38:18 2010
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1OeAaA-0001dq-4f
	for submit <at> debbugs.gnu.org; Wed, 28 Jul 2010 13:38:18 -0400
Received: from colin.muc.de ([193.149.48.1] helo=mail.muc.de)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <acm@HIDDEN>) id 1OeAa7-0001dk-GY
	for 6740 <at> debbugs.gnu.org; Wed, 28 Jul 2010 13:38:16 -0400
Received: (qmail 15504 invoked by uid 3782); 28 Jul 2010 17:38:25 -0000
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 19:38:23 +0200
Received: (qmail 3406 invoked by uid 1000); 28 Jul 2010 17:49:33 -0000
Date: Wed, 28 Jul 2010 17:49:33 +0000
To: Juanma Barranquero <lekktu@HIDDEN>
Subject: Re: bug#6740: Spurious byte compiler warnings
Message-ID: <20100728174933.GB2999@HIDDEN>
References: <20100727200619.GC2280@HIDDEN> <yxqmxtcwu1w.fsf@HIDDEN>
	<20100727212328.GD2280@HIDDEN>
	<AANLkTikdVKf70_nbaBbYPyjUE7iRZ1RXX8ybFJEvaXQe@HIDDEN>
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <AANLkTikdVKf70_nbaBbYPyjUE7iRZ1RXX8ybFJEvaXQe@HIDDEN>
User-Agent: Mutt/1.5.9i
X-Delivery-Agent: TMDA/1.1.5 (Fettercairn)
From: Alan Mackenzie <acm@HIDDEN>
X-Primary-Address: acm@HIDDEN
X-Spam-Score: -2.5 (--)
X-Debbugs-Envelope-To: 6740
Cc: Dan Nicolaescu <dann@HIDDEN>, 6740 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/pipermail/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -2.5 (--)

Hi, Juanma,

On Wed, Jul 28, 2010 at 12:57:04AM +0200, Juanma Barranquero wrote:
> On Tue, Jul 27, 2010 at 23:23, Alan Mackenzie <acm@HIDDEN> wrote:

> > It's a bug that the error message is repeated, at the very least.

> Yes, likely.

> > And the message is most assuredly false because (featurep 'cc-fix)
> > isn't always false - for example when it's run under XEmacs.

> Not, in code byte-compiled for Emacs it is always false because
> (featurep 'xemacs) is false. That means that optimized bytecode is not
> portable to XEmacs. But I don't think it was before (for a long time).

Optimised .elc isn't even compatible with earlier versions of Emacs.  But
this discussion is most emphatically NOT about compiled code.  It's about
the process of compiling sources.

> > At the very least, emitting such arcane warnings is unhelpful.  Are
> > there any circumstances in which such a warning might help a hacker
> > improve his code?  Surely we aren't in the business of making it
> > difficult to adapt code for XEmacs?

> You make it appear as it if were an attempt to warn about using
> XEmacs-specific code, but it is not, as Dan has pointed out.

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.)

> The warning is generic, the result of

>   (and X (featurep 'xemacs) Y Z...)  => (prog (and X) nil) => (prog X
> nil)   ; IIUC the comments in byte-opt.el...

Thanks for this explanation.

What do you mean by "generic" here?  Is the same trick performed on
symbols other than 'xemacs?

Surely it is a bug that "(featurep 'cc-fix)" appears in the message
rather than "(featurep 'xemacs)".  This situation is not about 'cc-fix,
it's about 'xemacs.

I would suggest that if I, a highly experienced Emacs hacker, remain
baffled by this message over many months, so will lots of others.  Does
anybody actually care about "(featurep 'xemacs)" being optimised away?
Again, who does this warning message help (other than the hackers who
wrote the optimisation code in the first place, of course)?


> from whence, "value returned from X is unused".

> > I think it's clear, the only code containing (featurep 'xemacs) is
> > portable code.

> The code is portable. The .elc is not.

Er, we're in strong agreement with this.

>     Juanma

-- 
Alan Mackenzie (Nuremberg, Germany).




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs@HIDDEN:
bug#6740; Package emacs. Full text available.

Message received at 6740 <at> debbugs.gnu.org:


Received: (at 6740) by debbugs.gnu.org; 27 Jul 2010 22:57:18 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jul 27 18:57:17 2010
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1Odt5J-0001df-DJ
	for submit <at> debbugs.gnu.org; Tue, 27 Jul 2010 18:57:17 -0400
Received: from mail-bw0-f44.google.com ([209.85.214.44])
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <lekktu@HIDDEN>) id 1Odt5H-0001dZ-UB
	for 6740 <at> debbugs.gnu.org; Tue, 27 Jul 2010 18:57:16 -0400
Received: by bwz7 with SMTP id 7so3968114bwz.3
	for <6740 <at> debbugs.gnu.org>; Tue, 27 Jul 2010 15:57:24 -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=OT4bTkiR6EhP33nlbLoSabYTwxBUNTRpGjT1vwdd1ew=;
	b=O0L7EQpOeaQXMCj3cu1BwVDR/QpqB+VnEpMx9oX6itISvg8M28VbTWfj+5h40HGzFv
	pZkCU4I5ef6hYE3nSNU/HbYqj5c2PckRMh5TgaiuUn8bEd/zjaJ5WhTO+KM2bV6iDRjv
	fu099/TaV8Dy9lz2O5ecFONmRDIKx+Zlg4wIU=
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=VT5jn0hqk3RBIObuSRw2bJlZvsE/DxChGtp9GR5iv/gOH2mwMcH/8+47mB9YsBz/BE
	bzAAGk6dT61Dbq+2cG/jD0uQlDUqMtHKeKDb4jFNTTk7u38NwDO0qfAZ7r8SQyGxY/rp
	g7xjOcrWl0AIT2nUTho1X3JeYWh3d6wJI3v4k=
Received: by 10.204.140.219 with SMTP id j27mr7234054bku.153.1280271444228; 
	Tue, 27 Jul 2010 15:57:24 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.204.180.136 with HTTP; Tue, 27 Jul 2010 15:57:04 -0700 (PDT)
In-Reply-To: <20100727212328.GD2280@HIDDEN>
References: <20100727200619.GC2280@HIDDEN> <yxqmxtcwu1w.fsf@HIDDEN>
	<20100727212328.GD2280@HIDDEN>
From: Juanma Barranquero <lekktu@HIDDEN>
Date: Wed, 28 Jul 2010 00:57:04 +0200
Message-ID: <AANLkTikdVKf70_nbaBbYPyjUE7iRZ1RXX8ybFJEvaXQe@HIDDEN>
Subject: Re: bug#6740: Spurious byte compiler warnings
To: Alan Mackenzie <acm@HIDDEN>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -2.7 (--)
X-Debbugs-Envelope-To: 6740
Cc: Dan Nicolaescu <dann@HIDDEN>, 6740 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/pipermail/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -2.7 (--)

On Tue, Jul 27, 2010 at 23:23, Alan Mackenzie <acm@HIDDEN> wrote:

> It's a bug that the error message is repeated, at the very least.

Yes, likely.

> And
> the message is most assuredly false because (featurep 'cc-fix) isn't
> always false - for example when it's run under XEmacs.

Not, in code byte-compiled for Emacs it is always false because
(featurep 'xemacs) is false. That means that optimized bytecode is not
portable to XEmacs. But I don't think it was before (for a long time).

> At the very least, emitting such arcane warnings is unhelpful. =C2=A0Are =
there
> any circumstances in which such a warning might help a hacker improve his
> code? =C2=A0Surely we aren't in the business of making it difficult to ad=
apt
> code for XEmacs?

You make it appear as it if were an attempt to warn about using
XEmacs-specific code, but it is not, as Dan has pointed out. The
warning is generic, the result of

  (and X (featurep 'xemacs) Y Z...)  =3D> (prog (and X) nil) =3D> (prog X
nil)   ; IIUC the comments in byte-opt.el...

from whence, "value returned from X is unused".

> I think it's clear, the only code containing (featurep 'xemacs) is
> portable code.

The code is portable. The .elc is not.

=C2=A0 =C2=A0 Juanma




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs@HIDDEN:
bug#6740; Package emacs. Full text available.

Message received at 6740 <at> debbugs.gnu.org:


Received: (at 6740) by debbugs.gnu.org; 27 Jul 2010 21:40:44 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jul 27 17:40:44 2010
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1OdrtE-000173-Go
	for submit <at> debbugs.gnu.org; Tue, 27 Jul 2010 17:40:44 -0400
Received: from impaqm2.telefonica.net ([213.4.138.2])
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <monnier@HIDDEN>) id 1OdrtC-00016y-Nf
	for 6740 <at> debbugs.gnu.org; Tue, 27 Jul 2010 17:40:43 -0400
Received: from IMPmailhost5.adm.correo ([10.20.102.126])
	by IMPaqm2.telefonica.net with bizsmtp
	id n3kl1e01j2jdgqJ3M9grQP; Tue, 27 Jul 2010 23:40:51 +0200
Received: from ceviche.home ([83.61.51.16])
	by IMPmailhost5.adm.correo with BIZ IMP
	id n9gq1e0060LyJBX1l9gqwB; Tue, 27 Jul 2010 23:40:51 +0200
X-Brightmail-Tracker: AAAAAA==
X-TE-authinfo: authemail="monnier$movistar.es"
	|auth_email="monnier@HIDDEN"
X-TE-AcuTerraCos: auth_cuTerraCos="cosuitnetc01"
Received: by ceviche.home (Postfix, from userid 20848)
	id 45E21660BB; Tue, 27 Jul 2010 23:40:50 +0200 (CEST)
From: Stefan Monnier <monnier@HIDDEN>
To: Dan Nicolaescu <dann@HIDDEN>
Subject: Re: bug#6740: Spurious byte compiler warnings
Message-ID: <jwvvd80iozu.fsf-monnier+emacs@HIDDEN>
References: <20100727200619.GC2280@HIDDEN> <yxqmxtcwu1w.fsf@HIDDEN>
Date: Tue, 27 Jul 2010 23:40:50 +0200
In-Reply-To: <yxqmxtcwu1w.fsf@HIDDEN> (Dan Nicolaescu's message of
	"Tue, 27 Jul 2010 16:26:03 -0400")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Spam-Score: -2.0 (--)
X-Debbugs-Envelope-To: 6740
Cc: Alan Mackenzie <acm@HIDDEN>, 6740 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/pipermail/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -2.0 (--)

>> Warning: value returned from (featurep (quote cc-fix)) is unused
>> Warning: value returned from (featurep (quote cc-fix)) is unused
>> 
>> It is obvious that that value is indeed used.  This is a bug.

> The byte compiler knows that (featurep 'xemacs) is false, so 
>  (and (not (featurep 'cc-fix)) ... )
> will be false, so the featurep result is indeed unused.

> If you use (and (featurep 'xemacs) (not (featurep 'cc-fix) ...
> the warning will go away.

It's one of those cases where the warning is the result of a check done
"too late" (i.e. after some optimization), which means the check is not
performed on the code the user sees, but on some massaged version of it.
It's difficult to avoid them, short of removing all "code
improvement" warnings.


        Stefan





Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs@HIDDEN:
bug#6740; Package emacs. Full text available.

Message received at 6740 <at> debbugs.gnu.org:


Received: (at 6740) by debbugs.gnu.org; 27 Jul 2010 21:12:15 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jul 27 17:12:14 2010
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1OdrRe-0000vs-6l
	for submit <at> debbugs.gnu.org; Tue, 27 Jul 2010 17:12:14 -0400
Received: from colin.muc.de ([193.149.48.1] helo=mail.muc.de)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <acm@HIDDEN>) id 1OdrRc-0000vm-KL
	for 6740 <at> debbugs.gnu.org; Tue, 27 Jul 2010 17:12:13 -0400
Received: (qmail 33688 invoked by uid 3782); 27 Jul 2010 21:12:20 -0000
Received: from acm.muc.de (pD9E52785.dip.t-dialin.net [217.229.39.133]) by
	colin2.muc.de (tmda-ofmipd) with ESMTP;
	Tue, 27 Jul 2010 23:12:19 +0200
Received: (qmail 4735 invoked by uid 1000); 27 Jul 2010 21:23:28 -0000
Date: Tue, 27 Jul 2010 21:23:28 +0000
To: Dan Nicolaescu <dann@HIDDEN>
Subject: Re: bug#6740: Spurious byte compiler warnings
Message-ID: <20100727212328.GD2280@HIDDEN>
References: <20100727200619.GC2280@HIDDEN> <yxqmxtcwu1w.fsf@HIDDEN>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <yxqmxtcwu1w.fsf@HIDDEN>
User-Agent: Mutt/1.5.9i
X-Delivery-Agent: TMDA/1.1.5 (Fettercairn)
From: Alan Mackenzie <acm@HIDDEN>
X-Primary-Address: acm@HIDDEN
X-Spam-Score: -2.5 (--)
X-Debbugs-Envelope-To: 6740
Cc: 6740 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/pipermail/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -2.5 (--)

Hi, Dan,

On Tue, Jul 27, 2010 at 04:26:03PM -0400, Dan Nicolaescu wrote:
> Alan Mackenzie <acm@HIDDEN> writes:

> > Hi, Emacs!

> > (i) Start Emacs, even a most recent bzr version, with -Q.
> > (ii) Put the following into the *scratch* buffer:

> >     (eval-when-compile
> >       (if (and (not (featurep 'cc-fix))
> >                (featurep 'xemacs)
> >                (progn
> >                  (require 'font-lock)
> >                  (let (font-lock-keywords)
> >                    (font-lock-compile-keywords '("\\<\\>"))
> >                    font-lock-keywords)))
> >           (cc-load "cc-fix")))

> >   (This fragment is at the top level, and taken from cc-defs.el.).
> > (iii) do M-x compile-defun on this form.

> > The byte compiler then issues the following two identical error
> > messages:

> >     Warning: value returned from (featurep (quote cc-fix)) is unused
> >     Warning: value returned from (featurep (quote cc-fix)) is unused

> > It is obvious that that value is indeed used.  This is a bug.

> The byte compiler knows that (featurep 'xemacs) is false, so 
>  (and (not (featurep 'cc-fix)) ... )
> will be false, so the featurep result is indeed unused.

Ah, thanks for the explanation!  But .....

It's a bug that the error message is repeated, at the very least.  And
the message is most assuredly false because (featurep 'cc-fix) isn't
always false - for example when it's run under XEmacs.

> If you use (and (featurep 'xemacs) (not (featurep 'cc-fix) ...
> the warning will go away.

At the very least, emitting such arcane warnings is unhelpful.  Are there
any circumstances in which such a warning might help a hacker improve his
code?  Surely we aren't in the business of making it difficult to adapt
code for XEmacs?

I think it's clear, the only code containing (featurep 'xemacs) is
portable code.  Can we please remove this unhelpful warning?

-- 
Alan Mackenzie (Nuremberg, Germany).




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs@HIDDEN:
bug#6740; Package emacs. Full text available.

Message received at 6740 <at> debbugs.gnu.org:


Received: (at 6740) by debbugs.gnu.org; 27 Jul 2010 20:25:57 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jul 27 16:25:57 2010
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1Odqir-0000aN-88
	for submit <at> debbugs.gnu.org; Tue, 27 Jul 2010 16:25:57 -0400
Received: from fencepost.gnu.org ([140.186.70.10])
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <dann@HIDDEN>) id 1Odqip-0000aI-4s
	for 6740 <at> debbugs.gnu.org; Tue, 27 Jul 2010 16:25:55 -0400
Received: from dann by fencepost.gnu.org with local (Exim 4.69)
	(envelope-from <dann@HIDDEN>)
	id 1Odqix-0004hF-7W; Tue, 27 Jul 2010 16:26:03 -0400
To: Alan Mackenzie <acm@HIDDEN>
Subject: Re: bug#6740: Spurious byte compiler warnings
References: <20100727200619.GC2280@HIDDEN>
From: Dan Nicolaescu <dann@HIDDEN>
X-Debbugs-No-Ack: yes
Date: Tue, 27 Jul 2010 16:26:03 -0400
In-Reply-To: <20100727200619.GC2280@HIDDEN> (Alan Mackenzie's message of "Tue\,
	27 Jul 2010 20\:06\:19 +0000")
Message-ID: <yxqmxtcwu1w.fsf@HIDDEN>
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Spam-Score: -6.5 (------)
X-Debbugs-Envelope-To: 6740
Cc: 6740 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/pipermail/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -6.5 (------)

Alan Mackenzie <acm@HIDDEN> writes:

> Hi, Emacs!
>
> (i) Start Emacs, even a most recent bzr version, with -Q.
> (ii) Put the following into the *scratch* buffer:
>
>     (eval-when-compile
>       (if (and (not (featurep 'cc-fix))
>                (featurep 'xemacs)
>                (progn
>                  (require 'font-lock)
>                  (let (font-lock-keywords)
>                    (font-lock-compile-keywords '("\\<\\>"))
>                    font-lock-keywords)))
>           (cc-load "cc-fix")))
>
>   (This fragment is at the top level, and taken from cc-defs.el.).
> (iii) do M-x compile-defun on this form.
>
> The byte compiler then issues the following two identical error
> messages:
>
>     Warning: value returned from (featurep (quote cc-fix)) is unused
>     Warning: value returned from (featurep (quote cc-fix)) is unused
>
> It is obvious that that value is indeed used.  This is a bug.

The byte compiler knows that (featurep 'xemacs) is false, so 
 (and (not (featurep 'cc-fix)) ... )
will be false, so the featurep result is indeed unused.

If you use (and (featurep 'xemacs) (not (featurep 'cc-fix) ...
the warning will go away.




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs@HIDDEN:
bug#6740; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 27 Jul 2010 19:55:11 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jul 27 15:55:11 2010
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1OdqF4-0000MN-22
	for submit <at> debbugs.gnu.org; Tue, 27 Jul 2010 15:55:10 -0400
Received: from mail.gnu.org ([199.232.76.166] helo=mx10.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <acm@HIDDEN>) id 1OdqF2-0000MI-92
	for submit <at> debbugs.gnu.org; Tue, 27 Jul 2010 15:55:08 -0400
Received: from lists.gnu.org ([199.232.76.165]:43130)
	by monty-python.gnu.org with esmtps
	(TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60)
	(envelope-from <acm@HIDDEN>) id 1OdqFA-0003AS-VD
	for submit <at> debbugs.gnu.org; Tue, 27 Jul 2010 15:55:17 -0400
Received: from [140.186.70.92] (port=39457 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1OdqF9-0003uc-I6
	for bug-gnu-emacs@HIDDEN; Tue, 27 Jul 2010 15:55:16 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_RP_MATCHES_RCVD
	autolearn=unavailable version=3.3.1
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
	(envelope-from <acm@HIDDEN>) id 1OdqF8-0001T7-Gu
	for bug-gnu-emacs@HIDDEN; Tue, 27 Jul 2010 15:55:15 -0400
Received: from colin.muc.de ([193.149.48.1]:3361 helo=mail.muc.de)
	by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from <acm@HIDDEN>)
	id 1OdqF8-0001St-7J
	for bug-gnu-emacs@HIDDEN; Tue, 27 Jul 2010 15:55:14 -0400
Received: (qmail 22094 invoked by uid 3782); 27 Jul 2010 19:55:12 -0000
Received: from acm.muc.de (pD9E52785.dip.t-dialin.net [217.229.39.133]) by
	colin2.muc.de (tmda-ofmipd) with ESMTP;
	Tue, 27 Jul 2010 21:55:11 +0200
Received: (qmail 3650 invoked by uid 1000); 27 Jul 2010 20:06:19 -0000
Date: Tue, 27 Jul 2010 20:06:19 +0000
To: bug-gnu-emacs@HIDDEN
Subject: Spurious byte compiler warnings
Message-ID: <20100727200619.GC2280@HIDDEN>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.5.9i
X-Delivery-Agent: TMDA/1.1.5 (Fettercairn)
From: Alan Mackenzie <acm@HIDDEN>
X-Primary-Address: acm@HIDDEN
X-detected-operating-system: by eggs.gnu.org: FreeBSD 4.6-4.9
X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6,
	seldom 2.4 (older, 4)
X-Spam-Score: -4.1 (----)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/pipermail/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -4.1 (----)

Hi, Emacs!

(i) Start Emacs, even a most recent bzr version, with -Q.
(ii) Put the following into the *scratch* buffer:

    (eval-when-compile
      (if (and (not (featurep 'cc-fix))
               (featurep 'xemacs)
               (progn
                 (require 'font-lock)
                 (let (font-lock-keywords)
                   (font-lock-compile-keywords '("\\<\\>"))
                   font-lock-keywords)))
          (cc-load "cc-fix")))

  (This fragment is at the top level, and taken from cc-defs.el.).
(iii) do M-x compile-defun on this form.

The byte compiler then issues the following two identical error
messages:

    Warning: value returned from (featurep (quote cc-fix)) is unused
    Warning: value returned from (featurep (quote cc-fix)) is unused

It is obvious that that value is indeed used.  This is a bug.

-- 
Alan Mackenzie (Nuremberg, Germany).




Acknowledgement sent to Alan Mackenzie <acm@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs@HIDDEN:
bug#6740; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Fri, 31 Oct 2014 17:00:04 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.