bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#43678: 27.1; compiler warning if code forgets to require cl-lib


From: Stefan Monnier
Subject: bug#43678: 27.1; compiler warning if code forgets to require cl-lib
Date: Mon, 28 Sep 2020 15:19:55 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

> 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 via email to

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