GNU bug report logs -
#72313
31.0.50; Warning about cl-member possibly being undefined when using cl-pushnew
Previous Next
Reported by: Tassilo Horn <tsdh <at> gnu.org>
Date: Fri, 26 Jul 2024 20:30:02 UTC
Severity: normal
Found in version 31.0.50
Done: Tassilo Horn <tsdh <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
Tassilo Horn <tsdh <at> 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.
This bug report was last modified 350 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.