GNU bug report logs - #15416
Unused lexical argument warnings not optimized away in featurep 'xemacs

Previous Next

Package: emacs;

Reported by: Glenn Morris <rgm <at> gnu.org>

Date: Thu, 19 Sep 2013 02:52:02 UTC

Severity: minor

Tags: wontfix

Found in version 24.3.50

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 15416 in the body.
You can then email your comments to 15416 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#15416; Package emacs. (Thu, 19 Sep 2013 02:52:02 GMT) Full text and rfc822 format available.

Message #3 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: submit <at> debbugs.gnu.org
Subject: Unused lexical argument warnings not optimized away in featurep
 'xemacs
Date: Wed, 18 Sep 2013 22:51:01 -0400
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?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15416; Package emacs. (Thu, 19 Sep 2013 13:56:02 GMT) Full text and rfc822 format available.

Message #6 received at 15416 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 15416 <at> debbugs.gnu.org
Subject: Re: bug#15416: Unused lexical argument warnings not optimized away in
 featurep 'xemacs
Date: Thu, 19 Sep 2013 09:55:22 -0400
> ; -*- 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 <body> (scan-error nil) (error (message "%S" err)))

and similar problems with some macros.


        Stefan




Added tag(s) wontfix. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Thu, 19 Sep 2013 16:21:01 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 15416 <at> debbugs.gnu.org and Glenn Morris <rgm <at> gnu.org> Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Thu, 19 Sep 2013 16:21:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 18 Oct 2013 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 11 years and 252 days ago.

Previous Next


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