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

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

bug#72313: 31.0.50; Warning about cl-member possibly being undefined whe


From: Jeremy Bryant
Subject: bug#72313: 31.0.50; Warning about cl-member possibly being undefined when using cl-pushnew
Date: Fri, 26 Jul 2024 22:20:57 +0100

Tassilo Horn <tsdh@gnu.org> writes:

> The following non-sensical code is a MWE triggering the warning
>
>   test.el: Warning: the function ‘cl-member’ might not be defined
>            at runtime.
>
> when byte-compiling it with
>
>   emacs -Q --batch -f batch-byte-compile test.el
>
> --8<---------------cut here---------------start------------->8---
> ;;  -*- lexical-binding: t; -*-
> (eval-when-compile
>   (require 'cl-lib))
>
> (defun foo ()
>   (let ((s (list 'a 'b)))
>     (cl-pushnew (list 1 2 3)
>                 s
>                 :test (lambda (_a _b) nil))))
> --8<---------------cut here---------------end--------------->8---
>
> Code with that shape of cl-pushnew usage can be found in AUCTeX's
> tex-info.el where it produces the same warning which sounds very strange
> given that the complete file doesn't use cl-member.
>
> I've checked the cl-lib code and could see that cl-pushnew expands to
> something with cl-adjoin which in turn has a compiler macro
> cl-compiler-macro-adjoin which could expand to something with cl-member
> (but doesn't in this case, I think?)...
>
> My assumption is that (eval-when-compile (require 'cl-lib)) should be
> fine when using only macros from cl-lib which in turn should expand to
> cl-free code, i.e., the byte code doesn't require cl-lib at runtime.
> If, however, cl-pushnew can expand to something using cl-member (a
> function), that wouldn't be true.

Adding Stefan M.





reply via email to

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