unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Michael Heerdegen <michael_heerdegen@web.de>
To: Yuta Yamada <sleepboy.zzz@gmail.com>
Cc: 23495@debbugs.gnu.org
Subject: 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	[thread overview]
Message-ID: <87shxpigij.fsf@web.de> (raw)
In-Reply-To: <20160510.164549.497097338322088203.sleepboy.zzz@gmail.com> (Yuta Yamada's message of "Tue, 10 May 2016 16:45:49 -0700 (PDT)")

Yuta Yamada <sleepboy.zzz@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.





  reply	other threads:[~2016-05-11  0:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-09  8:12 bug#23495: byte-compile-file return t when there is "XXX can't use lexical var" error Yuta Yamada
2016-05-10 18:23 ` Michael Heerdegen
2016-05-10 23:45   ` Yuta Yamada
2016-05-11  0:29     ` Michael Heerdegen [this message]
2016-05-11 11:57       ` Michael Heerdegen
2016-05-11 14:33         ` Yuta Yamada
2016-05-11 16:25           ` Michael Heerdegen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87shxpigij.fsf@web.de \
    --to=michael_heerdegen@web.de \
    --cc=23495@debbugs.gnu.org \
    --cc=sleepboy.zzz@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).