all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#15103: 24.3.50; Wrong byte compiler warning
@ 2013-08-15 11:49 Michael Albinus
  2013-08-15 14:50 ` Stefan Monnier
  2013-10-04  3:41 ` Stefan Monnier
  0 siblings, 2 replies; 4+ messages in thread
From: Michael Albinus @ 2013-08-15 11:49 UTC (permalink / raw
  To: 15103

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.





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#15103: 24.3.50; Wrong byte compiler warning
  2013-08-15 11:49 bug#15103: 24.3.50; Wrong byte compiler warning Michael Albinus
@ 2013-08-15 14:50 ` Stefan Monnier
  2013-10-04  3:41 ` Stefan Monnier
  1 sibling, 0 replies; 4+ messages in thread
From: Stefan Monnier @ 2013-08-15 14:50 UTC (permalink / raw
  To: Michael Albinus; +Cc: 15103

> 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





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#15103: 24.3.50; Wrong byte compiler warning
  2013-08-15 11:49 bug#15103: 24.3.50; Wrong byte compiler warning Michael Albinus
  2013-08-15 14:50 ` Stefan Monnier
@ 2013-10-04  3:41 ` Stefan Monnier
  2013-10-08  9:35   ` Michael Albinus
  1 sibling, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2013-10-04  3:41 UTC (permalink / raw
  To: Michael Albinus; +Cc: 15103

> 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





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#15103: 24.3.50; Wrong byte compiler warning
  2013-10-04  3:41 ` Stefan Monnier
@ 2013-10-08  9:35   ` Michael Albinus
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Albinus @ 2013-10-08  9:35 UTC (permalink / raw
  To: Stefan Monnier; +Cc: 15103

Stefan Monnier <monnier@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.





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-10-08  9:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-15 11:49 bug#15103: 24.3.50; Wrong byte compiler warning Michael Albinus
2013-08-15 14:50 ` Stefan Monnier
2013-10-04  3:41 ` Stefan Monnier
2013-10-08  9:35   ` Michael Albinus

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.