Subject: Re: bug#75521: scratch/igc: Delete unused macro DEFVAR_LISP_NOPROX

From: Pip Cet <[email-masked]>
Date: Sun, 12 Jan 2025 22:36:12 +0000

"Stefan Kangas" <[email-masked]> writes:

> Gerd Möllmann <[email-masked]> writes:
>
>> Stefan Kangas <[email-masked]> writes:
>>
>>> Severity: wishlist
>>>
>>> Can we delete the unused macro DEFVAR_LISP_NOPROX?
>>
>> +1
>
> Thanks, done, closing.

Thanks!

On master, this comment might need revising (staticpro now easserts that
the same variable isn't added twice):

/* Similar but define a variable whose value is the Lisp Object stored
   at address.  Two versions: with and without gc-marking of the C
   variable.  The nopro version is used when that variable will be
   gc-marked for some other reason, since marking the same slot twice
   can cause trouble with strings.  */
void
defvar_lisp_nopro (struct Lisp_Fwd const *o_fwd, char const *namestring)
{
  eassert (o_fwd->type == Lisp_Fwd_Obj);
  Lisp_Object sym = intern_c_string (namestring);
  XBARE_SYMBOL (sym)->u.s.declared_special = true;
  XBARE_SYMBOL (sym)->u.s.redirect = SYMBOL_FORWARDED;
  SET_SYMBOL_FWD (XBARE_SYMBOL (sym), o_fwd);
}

Also on master, the single user of DEFVAR_LISP_NOPRO is questionable:
font.c doesn't staticpro Vfont_weight_table because it appears in
font_style_table, but then font_style_table is sometimes modified so it
points to a new vector, and I don't see how Vfont_weight_table is
protected then.

GDB experiment seems to indicate it's not protected at all, but it's in
the dump so it isn't freed either.  When --enable-checking is in use,
however, pdumper.c will abort the next time it sees an object that
wasn't marked during a previous GC run.

Pip