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.

Full log


View this message in rfc822 format

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 15416 <at> debbugs.gnu.org
Subject: 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




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.