[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#15103: 24.3.50; Wrong byte compiler warning

From: Stefan Monnier
Subject: bug#15103: 24.3.50; Wrong byte compiler warning
Date: Thu, 15 Aug 2013 10:50:25 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]