GNU bug report logs - #15103
Spurious "unused lexical argument" warning from condition-case

Previous Next

Package: emacs;

Reported by: Michael Albinus <michael.albinus <at> gmx.de>

Date: Thu, 15 Aug 2013 11:51:01 UTC

Severity: minor

Merged with 20123

Found in versions 24.3.50, 24.4.91

Fixed in version 25.1

Done: Stefan Monnier <monnier <at> IRO.UMontreal.CA>

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 15103 in the body.
You can then email your comments to 15103 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#15103; Package emacs. (Thu, 15 Aug 2013 11:51:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Michael Albinus <michael.albinus <at> gmx.de>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 15 Aug 2013 11:51:02 GMT) Full text and rfc822 format available.

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

From: Michael Albinus <michael.albinus <at> gmx.de>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.3.50; Wrong byte compiler warning
Date: Thu, 15 Aug 2013 13:49:38 +0200
I have a file test.el:

(condition-case err
    (ignore)
  (file-error (ignore))
  (error (message "%s" (error-message-string err))))

When I compile it with --eval '(setq byte-compile-force-lexical-warnings t)'
I get the byte compiler warning

In toplevel form:
test.el:1:1:Warning: Unused lexical argument `err'
Wrote /home/albinus/tmp/test.elc

Note, that this warning does not appear when the first condition-case
handler does not exist.

Best regards, Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15103; Package emacs. (Thu, 15 Aug 2013 14:51:02 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: 15103 <at> debbugs.gnu.org
Subject: Re: bug#15103: 24.3.50; Wrong byte compiler warning
Date: Thu, 15 Aug 2013 10:50:25 -0400
> I have a file test.el:
> (condition-case err
>     (ignore)
>   (file-error (ignore))
>   (error (message "%s" (error-message-string err))))

> When I compile it with --eval '(setq byte-compile-force-lexical-warnings t)'
> I get the byte compiler warning

> In toplevel form:
> test.el:1:1:Warning: Unused lexical argument `err'
> Wrote /home/albinus/tmp/test.elc

> Note, that this warning does not appear when the first condition-case
> handler does not exist.

Yup, same kind of problem as discussed in the "Cleaning up code" thread.
When compiling for lexical scoping, the condition case above gets turned
internally into something akin to:

 (condition-case :use-lexical-calling-convention
     (ignore)
   (file-error (lambda (err) (ignore)))
   (error (lambda (err) (message "%s" (error-message-string err)))))

so as you can see, we now have two separate declarations of `err' one of
which is unused.
There's a secondary bug as well in that the warning says "argument"
rather than "variable", but that's minor.


        Stefan




Changed bug title to 'Spurious "unused lexical argument" warning from condition-case' from '24.3.50; Wrong byte compiler warning' Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Tue, 20 Aug 2013 00:13:01 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15103; Package emacs. (Fri, 04 Oct 2013 03:42:02 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: 15103 <at> debbugs.gnu.org
Subject: Re: bug#15103: 24.3.50; Wrong byte compiler warning
Date: Thu, 03 Oct 2013 23:41:50 -0400
> I have a file test.el:
> (condition-case err
>     (ignore)
>   (file-error (ignore))
>   (error (message "%s" (error-message-string err))))
[...]
> In toplevel form:
> test.el:1:1:Warning: Unused lexical argument `err'
> Wrote /home/albinus/tmp/test.elc

If you set byte-compile--use-old-handlers to nil, the above spurious
warning should now be fixed.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#15103; Package emacs. (Tue, 08 Oct 2013 09:36:01 GMT) Full text and rfc822 format available.

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

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 15103 <at> debbugs.gnu.org
Subject: Re: bug#15103: 24.3.50; Wrong byte compiler warning
Date: Tue, 08 Oct 2013 11:35:03 +0200
Stefan Monnier <monnier <at> iro.umontreal.ca> writes:

> If you set byte-compile--use-old-handlers to nil, the above spurious
> warning should now be fixed.

That works, thanks. Shouldn't this be documented somewhere?

>         Stefan

Best regrads, Michael.




Forcibly Merged 15103 20123. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Mon, 16 Mar 2015 18:58: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. (Tue, 14 Apr 2015 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 9 years and 27 days ago.

Previous Next


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