unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: "Roland Winkler" <winkler@gnu.org>
Cc: 43678@debbugs.gnu.org
Subject: bug#43678: 27.1; compiler warning if code forgets to require cl-lib
Date: Mon, 28 Sep 2020 15:19:55 -0400	[thread overview]
Message-ID: <jwvft71zpgu.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <10063.90714.979619.24434@gargle.gargle.HOWL> (Roland Winkler's message of "Mon, 28 Sep 2020 20:11:27 +0200")

> Until earlier today, several files in bbdb did not require cl-lib,
> when they should have done that.  Nonetheless, bbdb compiled fine
> with emacs 25 and 26, but not anymore with emacs 27, see bug #30635.
> The goal when fixing #30635 was to issue a warning if a library uses
> cl-lib without requiring it.  The problem with bbdb was, however,
> that instead the emacs 27 byte compiler threw a rather unhelpful
> error message about the cause of the problem.  For bbdb-tex.el, it
> said
>
> In bbdb-TeX:
> bbdb-tex.el:414:25:Error: Forgot to expand macro cl-progv in ( ...
>
> I suggest that the byte compiler should issue a more helpful warning
> about the cause of the problem.

Could you show how you got that error?
When I try to compile bbdb-tex.el I get the following:

    % src/emacs -L .../elpa/packages/bbdb/ -Q --batch -f batch-byte-compile .../elpa/packages/bbdb/bbdb-tex.el
    
    In end of data:
    .../elpa/packages/bbdb/bbdb-tex.el:568:1: Warning: the function ‘cl-progv’ is
        not known to be defined.
    %

Which is the source of the error and which I hoped was "helpful enough".

This is just a "warning" but it actually results in the file being
miscompiled.  The byte-compiler only issues a warning rather than an
error because it doesn't know `cl-progv` (and hence doesn't know that
it's a macro either) at that point and hence just assumes that it will
be defined as a function.

If you later load that `bbdb-tex.elc` file and use the `bbdb-tex`
function, when it gets to the point of executing the code with the
`cl-progv` it will indeed signal something like the error you've shown
(because the byte code tries to call the `cl-progv` *function* but finds
a *macro* in its stead).


        Stefan






  reply	other threads:[~2020-09-28 19:19 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-28 18:11 bug#43678: 27.1; compiler warning if code forgets to require cl-lib Roland Winkler
2020-09-28 19:19 ` Stefan Monnier [this message]
2020-09-28 19:33   ` Roland Winkler
2020-09-28 20:04     ` Stefan Monnier
2020-09-28 20:31       ` Roland Winkler
2020-09-28 20:42         ` Stefan Monnier
2020-09-28 21:06           ` Roland Winkler
2020-09-29 14:53       ` Lars Ingebrigtsen
2020-09-30  5:10         ` Howard Melman
2020-09-30 14:12           ` Lars Ingebrigtsen

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=jwvft71zpgu.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=43678@debbugs.gnu.org \
    --cc=winkler@gnu.org \
    /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).