all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Jeremy Bryant via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Tassilo Horn <tsdh@gnu.org>
Cc: 72313@debbugs.gnu.org, Stefan Monnier <monnier@iro.umontreal.ca>
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	[thread overview]
Message-ID: <87ttgbalza.fsf@jeremybryant.net> (raw)
In-Reply-To: <874j8bx5gr.fsf@gnu.org> (Tassilo Horn's message of "Fri, 26 Jul 2024 22:29:08 +0200")

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	other threads:[~2024-07-26 21:20 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-26 20:29 bug#72313: 31.0.50; Warning about cl-member possibly being undefined when using cl-pushnew Tassilo Horn
2024-07-26 21:20 ` Jeremy Bryant via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2024-07-27  7:01 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-27  7:13   ` Tassilo Horn
2024-07-27  7:49     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-07-27 15:29       ` Arash Esbati
2024-07-27 20:50         ` Tassilo Horn
2024-07-27 21:25           ` Arash Esbati
2024-07-31 17:44             ` Tassilo Horn
2024-07-31 19:55               ` Arash Esbati
2024-07-28  4:58           ` Eli Zaretskii

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

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

  git send-email \
    --in-reply-to=87ttgbalza.fsf@jeremybryant.net \
    --to=bug-gnu-emacs@gnu.org \
    --cc=72313@debbugs.gnu.org \
    --cc=jb@jeremybryant.net \
    --cc=monnier@iro.umontreal.ca \
    --cc=tsdh@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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.