unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#14831: cl-member warnings during bootstrap
@ 2013-07-09 14:42 Juanma Barranquero
  2013-07-09 15:54 ` Glenn Morris
  0 siblings, 1 reply; 13+ messages in thread
From: Juanma Barranquero @ 2013-07-09 14:42 UTC (permalink / raw)
  To: 14831

Package: emacs
Version: 24.3.50

During bootstrap, there are two cl-member related warnings:

In end of data:
international/mule-cmds.el:2981:1:Warning: the function `cl-member' is not
    known to be defined.

In end of data:
replace.el:2338:1:Warning: the function `cl-member' is not known to be
    defined.

and indeed, mule-cmds.elc and replace.elc contain references to
cl-member. Recompiling these files after bootstrap removes these
references.





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#14831: cl-member warnings during bootstrap
  2013-07-09 14:42 bug#14831: cl-member warnings during bootstrap Juanma Barranquero
@ 2013-07-09 15:54 ` Glenn Morris
  2013-07-09 15:56   ` Juanma Barranquero
  2013-07-15 11:36   ` Juanma Barranquero
  0 siblings, 2 replies; 13+ messages in thread
From: Glenn Morris @ 2013-07-09 15:54 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: 14831

Juanma Barranquero wrote:

> In end of data:
> international/mule-cmds.el:2981:1:Warning: the function `cl-member' is not
>     known to be defined.
>
> In end of data:
> replace.el:2338:1:Warning: the function `cl-member' is not known to be
>     defined.

It is not a real problem. It is due to

(or (load "cl-loaddefs" 'noerror 'quiet)
    ;; When bootstrapping, cl-loaddefs hasn't been built yet!
    (require 'cl-macs))

Loading cl-seq as well as cl-macs would make it go away.





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#14831: cl-member warnings during bootstrap
  2013-07-09 15:54 ` Glenn Morris
@ 2013-07-09 15:56   ` Juanma Barranquero
  2013-07-15 11:36   ` Juanma Barranquero
  1 sibling, 0 replies; 13+ messages in thread
From: Juanma Barranquero @ 2013-07-09 15:56 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 14831

On Tue, Jul 9, 2013 at 5:54 PM, Glenn Morris <rgm@gnu.org> wrote:

> It is not a real problem. It is due to

OK.

> Loading cl-seq as well as cl-macs would make it go away.

Any reason not to do so?





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#14831: cl-member warnings during bootstrap
  2013-07-09 15:54 ` Glenn Morris
  2013-07-09 15:56   ` Juanma Barranquero
@ 2013-07-15 11:36   ` Juanma Barranquero
  2013-07-15 16:10     ` Glenn Morris
  1 sibling, 1 reply; 13+ messages in thread
From: Juanma Barranquero @ 2013-07-15 11:36 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 14831

On Tue, Jul 9, 2013 at 5:54 PM, Glenn Morris <rgm@gnu.org> wrote:

> It is not a real problem. It is due to
>
> (or (load "cl-loaddefs" 'noerror 'quiet)
>     ;; When bootstrapping, cl-loaddefs hasn't been built yet!
>     (require 'cl-macs))
>
> Loading cl-seq as well as cl-macs would make it go away.

Hmm. I added (require 'cl-seq), bootstrapped, and the cl-member
warnings didn't go away.





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#14831: cl-member warnings during bootstrap
  2013-07-15 11:36   ` Juanma Barranquero
@ 2013-07-15 16:10     ` Glenn Morris
  2013-07-15 16:23       ` Juanma Barranquero
  0 siblings, 1 reply; 13+ messages in thread
From: Glenn Morris @ 2013-07-15 16:10 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: 14831

Juanma Barranquero wrote:

>> Loading cl-seq as well as cl-macs would make it go away.
>
> Hmm. I added (require 'cl-seq), bootstrapped, and the cl-member
> warnings didn't go away.

Works for me (after changing cl-seq to provide itself).





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#14831: cl-member warnings during bootstrap
  2013-07-15 16:10     ` Glenn Morris
@ 2013-07-15 16:23       ` Juanma Barranquero
  2013-07-15 19:48         ` Glenn Morris
  0 siblings, 1 reply; 13+ messages in thread
From: Juanma Barranquero @ 2013-07-15 16:23 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 14831

On Mon, Jul 15, 2013 at 6:10 PM, Glenn Morris <rgm@gnu.org> wrote:

> Works for me (after changing cl-seq to provide itself).

Well, are you going to install the change, then, or is there any downside?

   J





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#14831: cl-member warnings during bootstrap
  2013-07-15 16:23       ` Juanma Barranquero
@ 2013-07-15 19:48         ` Glenn Morris
  2013-07-15 19:50           ` Juanma Barranquero
  2013-07-16  0:19           ` Stefan Monnier
  0 siblings, 2 replies; 13+ messages in thread
From: Glenn Morris @ 2013-07-15 19:48 UTC (permalink / raw)
  To: Juanma Barranquero; +Cc: 14831

Juanma Barranquero wrote:

> Well, are you going to install the change, then, or is there any downside?

I think it's up to Stefan, who authored the current state.
AFAIK, the warnings are harmless. Loading extra files slows down the
build by some fractional amount (that's the only downside I can see).
So maybe he prefers to leave it as-is.





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#14831: cl-member warnings during bootstrap
  2013-07-15 19:48         ` Glenn Morris
@ 2013-07-15 19:50           ` Juanma Barranquero
  2013-07-16  0:19           ` Stefan Monnier
  1 sibling, 0 replies; 13+ messages in thread
From: Juanma Barranquero @ 2013-07-15 19:50 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 14831

> I think it's up to Stefan, who authored the current state.
> AFAIK, the warnings are harmless. Loading extra files slows down the
> build by some fractional amount (that's the only downside I can see).
> So maybe he prefers to leave it as-is.

OK, thanks.





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#14831: cl-member warnings during bootstrap
  2013-07-15 19:48         ` Glenn Morris
  2013-07-15 19:50           ` Juanma Barranquero
@ 2013-07-16  0:19           ` Stefan Monnier
  2013-07-16  1:37             ` Glenn Morris
  1 sibling, 1 reply; 13+ messages in thread
From: Stefan Monnier @ 2013-07-16  0:19 UTC (permalink / raw)
  To: Glenn Morris; +Cc: Juanma Barranquero, 14831

>> Well, are you going to install the change, then, or is there any downside?
> I think it's up to Stefan, who authored the current state.
> AFAIK, the warnings are harmless. Loading extra files slows down the
> build by some fractional amount (that's the only downside I can see).
> So maybe he prefers to leave it as-is.

It might be worth checking the impact on the bootstrap time.
I'd like to understand exactly where those `cl-member's come from.
I suspect the missing part is the (put 'cl-member 'compiler-macro
#'cl--compiler-macro-member) which is normally in cl-loaddefs.el.

Those residual cl-member calls may actually be a real problem, so maybe
this is not just a minor cosmetic fix.


        Stefan "who can't dig into it further now"





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#14831: cl-member warnings during bootstrap
  2013-07-16  0:19           ` Stefan Monnier
@ 2013-07-16  1:37             ` Glenn Morris
  2013-07-16  8:57               ` Stefan Monnier
  0 siblings, 1 reply; 13+ messages in thread
From: Glenn Morris @ 2013-07-16  1:37 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Juanma Barranquero, 14831

Stefan Monnier wrote:

> I'd like to understand exactly where those `cl-member's come from.
> I suspect the missing part is the (put 'cl-member 'compiler-macro
> #'cl--compiler-macro-member) which is normally in cl-loaddefs.el.
>
> Those residual cl-member calls may actually be a real problem, so maybe
> this is not just a minor cosmetic fix.

Deleting cl-loadefs.el and batch byte-compiling a file with sole contents:

(defvar foo-bar nil)
(add-to-list 'foo-bar 1)

produces byte-code containing cl-member. Makes no sense to me...

You are correct that adding

(eval-and-compile (put 'cl-member 'compiler-macro#'cl--compiler-macro-member))

to the start of the file seems to fix it.





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#14831: cl-member warnings during bootstrap
  2013-07-16  1:37             ` Glenn Morris
@ 2013-07-16  8:57               ` Stefan Monnier
  2013-07-16 17:12                 ` Glenn Morris
  0 siblings, 1 reply; 13+ messages in thread
From: Stefan Monnier @ 2013-07-16  8:57 UTC (permalink / raw)
  To: Glenn Morris; +Cc: Juanma Barranquero, 14831

>> I'd like to understand exactly where those `cl-member's come from.
>> I suspect the missing part is the (put 'cl-member 'compiler-macro
>> #'cl--compiler-macro-member) which is normally in cl-loaddefs.el.
>> 
>> Those residual cl-member calls may actually be a real problem, so maybe
>> this is not just a minor cosmetic fix.

> Deleting cl-loadefs.el and batch byte-compiling a file with sole contents:

> (defvar foo-bar nil)
> (add-to-list 'foo-bar 1)

> produces byte-code containing cl-member. Makes no sense to me...

Aha!  So it's the compiler-macro of add-to-list which turns an
add-to-list call into a cl-pushnew call, which is then macro-expanded to
something that uses cl-member, which should be turned into a plain
`member' by `cl--compiler-macro-member'.  So it can be fixed by changing
the compiler-macro of add-to-list not to use cl-pushnew.


        Stefan





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#14831: cl-member warnings during bootstrap
  2013-07-16  8:57               ` Stefan Monnier
@ 2013-07-16 17:12                 ` Glenn Morris
  2013-07-22 20:40                   ` Stefan Monnier
  0 siblings, 1 reply; 13+ messages in thread
From: Glenn Morris @ 2013-07-16 17:12 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: Juanma Barranquero, 14831

Stefan Monnier wrote:

> Aha!  So it's the compiler-macro of add-to-list which turns an
> add-to-list call into a cl-pushnew call, which is then macro-expanded to
> something that uses cl-member, which should be turned into a plain
> `member' by `cl--compiler-macro-member'.  So it can be fixed by changing
> the compiler-macro of add-to-list not to use cl-pushnew.

Or move the

(put 'cl-member 'compiler-macro #'cl--compiler-macro-member)

from cl-seq to cl-macs (and probably the same for cl-assoc).
That seems fine to me, since that is where cl--compiler-macro-member is
defined, but I guess you might want to keep that statement where
cl-member is defined instead.





^ permalink raw reply	[flat|nested] 13+ messages in thread

* bug#14831: cl-member warnings during bootstrap
  2013-07-16 17:12                 ` Glenn Morris
@ 2013-07-22 20:40                   ` Stefan Monnier
  0 siblings, 0 replies; 13+ messages in thread
From: Stefan Monnier @ 2013-07-22 20:40 UTC (permalink / raw)
  To: Glenn Morris; +Cc: Juanma Barranquero, 14831-done

>> Aha!  So it's the compiler-macro of add-to-list which turns an
>> add-to-list call into a cl-pushnew call, which is then macro-expanded to
>> something that uses cl-member, which should be turned into a plain
>> `member' by `cl--compiler-macro-member'.  So it can be fixed by changing
>> the compiler-macro of add-to-list not to use cl-pushnew.

I installed the patch below which tightens things up a bit.


        Stefan


=== modified file 'lisp/subr.el'
--- lisp/subr.el	2013-07-19 12:18:16 +0000
+++ lisp/subr.el	2013-07-22 16:46:55 +0000
@@ -1498,9 +1498,10 @@
       ;; FIXME: Something like this could be used for `set' as well.
       (if (or (not (eq 'quote (car-safe list-var)))
               (special-variable-p (cadr list-var))
-              (and append compare-fn))
+              (not (macroexp-const-p append)))
           exp
         (let* ((sym (cadr list-var))
+               (append (eval append))
                (msg (format "`add-to-list' can't use lexical var `%s'; use `push' or `cl-pushnew'"
                             sym))
                ;; Big ugly hack so we only output a warning during
@@ -1513,13 +1514,17 @@
                           (when (assq sym byte-compile--lexical-environment)
                             (byte-compile-log-warning msg t :error))))
                (code
-                (if append
                     (macroexp-let2 macroexp-copyable-p x element
-                    `(unless (member ,x ,sym)
-                       (setq ,sym (append ,sym (list ,x)))))
+                  `(unless ,(if compare-fn
+                                (progn
                   (require 'cl-lib)
-                  `(cl-pushnew ,element ,sym
-                               :test ,(or compare-fn '#'equal)))))
+                                  `(cl-member ,x ,sym :test ,compare-fn))
+                              ;; For bootstrapping reasons, don't rely on
+                              ;; cl--compiler-macro-member for the base case.
+                              `(member ,x ,sym))
+                     ,(if append
+                          `(setq ,sym (append ,sym (list ,x)))
+                        `(push ,x ,sym))))))
           (if (not (macroexp--compiling-p))
               code
             `(progn






^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2013-07-22 20:40 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-09 14:42 bug#14831: cl-member warnings during bootstrap Juanma Barranquero
2013-07-09 15:54 ` Glenn Morris
2013-07-09 15:56   ` Juanma Barranquero
2013-07-15 11:36   ` Juanma Barranquero
2013-07-15 16:10     ` Glenn Morris
2013-07-15 16:23       ` Juanma Barranquero
2013-07-15 19:48         ` Glenn Morris
2013-07-15 19:50           ` Juanma Barranquero
2013-07-16  0:19           ` Stefan Monnier
2013-07-16  1:37             ` Glenn Morris
2013-07-16  8:57               ` Stefan Monnier
2013-07-16 17:12                 ` Glenn Morris
2013-07-22 20:40                   ` Stefan Monnier

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).