GNU bug report logs - #23495
byte-compile-file return t when there is "XXX can't use lexical var" error

Previous Next

Package: emacs;

Reported by: Yuta Yamada <sleepboy.zzz <at> gmail.com>

Date: Mon, 9 May 2016 17:20:03 UTC

Severity: normal

Tags: fixed

Merged with 24359, 24360

Found in version 25.1

Fixed in version 26

Done: npostavs <at> users.sourceforge.net

Bug is archived. No further changes may be made.

Full log


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

From: Michael Heerdegen <michael_heerdegen <at> web.de>
To: Yuta Yamada <sleepboy.zzz <at> gmail.com>
Cc: 23495 <at> debbugs.gnu.org
Subject: Re: bug#23495: byte-compile-file return t when there is "XXX can't
 use lexical var" error
Date: Wed, 11 May 2016 02:29:24 +0200
Yuta Yamada <sleepboy.zzz <at> gmail.com> writes:

> Hi, I checked add-to-list fucntion in subr.el and I saw some fixme
> comments. Is this actually a warning? If so, should this warning
> return non zero status code when users specified `(setq
> byte-compile-error-on-warn t)`?

When there is a variable of the same in the dynamic scope, the
code will work.  So, a warning seems reasonable.


> I tried following command to compile:
>
> ----
> $ emacs -Q -batch --eval '(setq byte-compile-error-on-warn t)' -f
> batch-byte-compile ./foo.el
>
> In foo:
> foo.el:9:13:Error: `add-to-list' can't use lexical var `a'; use `push' or
>     `cl-pushnew'
> $ echo $?
> 0

> But, it returns 0. Is this desired behavior? or a bug?

Seems it's wanted.  The compiler calls `byte-compile-log-warning' in
this case, which, unlike `byte-compile-warn', circumvents
`byte-compile-error-on-warn'.

Someone with more knowledge about the byte compiler might want to
correct me.


I think you could get what you want by customizing `warning-levels',
like

(setcdr (cdr (assoc :error warning-levels))
        (list (lambda () (error "Error!"))))

or so.  I'm not sure if this is a good idea.



Michael.




This bug report was last modified 8 years and 284 days ago.

Previous Next


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