unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Question about DEFVAR_LISP_NOPRO
@ 2024-04-05 15:10 Gerd Möllmann
  2024-04-05 16:24 ` Stefan Monnier
  0 siblings, 1 reply; 8+ messages in thread
From: Gerd Möllmann @ 2024-04-05 15:10 UTC (permalink / raw)
  To: emacs-devel; +Cc: Stefan Monnier

I came across another esoteric question in the context of a moving GC.

Emacs contains has a few uses of DEFVAR_LISP_NOPRO, which is like
DEFVAR_LISP, except that it does not staticpro the variable.

  #define DEFVAR_LISP_NOPRO(lname, vname, doc)	\
    do {					\
      static struct Lisp_Objfwd const o_fwd	\
        = {Lisp_Fwd_Obj, &globals.f_##vname};	\
      defvar_lisp_nopro (&o_fwd, lname);	\
    } while (false)

Example:

  DEFVAR_LISP_NOPRO ("font-weight-table", Vfont_weight_table,
                 doc: /*  Vector of valid font weight values. ... */);
    Vfont_weight_table = BUILD_STYLE_TABLE (weight_table);
    make_symbol_constant (intern_c_string ("font-weight-table"));

Here a symbol is defined which has a value that is forwarded to the
static globals.f_Vfont_weight_table, but that static is not staticpro'd.

My question is simply: What the heck?

I understand that this can be necessary, in rare cases, when one needs to
staticpro stuff before defvar_lisp is usable, during Emacs' startup. I've
done that myself, but the other cases make no sense to me.

Does someone perhaps have an idea what other reasons could be to use
DEFVAR_LISP_NOPRO?



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

end of thread, other threads:[~2024-05-18 13:22 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-05 15:10 Question about DEFVAR_LISP_NOPRO Gerd Möllmann
2024-04-05 16:24 ` Stefan Monnier
2024-04-05 16:37   ` Gerd Möllmann
2024-04-05 17:16     ` Stefan Monnier
2024-04-05 18:15       ` Gerd Möllmann
2024-04-05 18:16         ` Stefan Monnier
2024-05-18 12:40   ` K. Handa
2024-05-18 13:22     ` Gerd Möllmann

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