emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ./configure --enable-check-lisp-object-type


From: Eli Zaretskii
Subject: Re: ./configure --enable-check-lisp-object-type
Date: Tue, 12 Apr 2022 20:43:29 +0300

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Cc: "emacs-devel@gnu.org" <emacs-devel@gnu.org>
> Date: Tue, 12 Apr 2022 13:23:21 -0400
> 
> > For the first time in a while I enabled the Lisp object type, and I was
> > given a wall of
> 
> I've been using it for many many years.
> 
> > dispnew.c:6593:1: note: in expansion of macro ‘DEFUN’
> >  6593 | DEFUN ("internal-show-cursor-p", Finternal_show_cursor_p,
> >       | ^~~~~
> > lisp.h:3179:5: warning: missing braces around initializer [-Wmissing-braces]
> >  3179 |     {{{{ PVEC_SUBR << PSEUDOVECTOR_AREA_BITS },                     
> >     \
> >       |     ^
> >
> > for every DEFUN.  That's new, isn't it?  (This is on Debian/bookworm.)
> 
> Yes, it's new enough that I haven't reported it yet.

The last change there was done 2 years ago, if my Git forensics are
correct.  So I wonder what exactly happened recently that started
triggering this.

> > #define DEFUN(lname, fnname, sname, minargs, maxargs, intspec, doc) \
> >   SUBR_SECTION_ATTRIBUTE                                                \
> >   static union Aligned_Lisp_Subr sname =                                \
> >      {{{ PVEC_SUBR << PSEUDOVECTOR_AREA_BITS },                             
> > \
> >        { .a ## maxargs = fnname },                                  \
> >        minargs, maxargs, lname, {intspec}, 0}};                             
> > \
> >    Lisp_Object fnname
> >
> > That seems like beaucoup de braces, so is that a gcc bug or something?
> > (Adding more braces makes compilation fail.)
> 
> I don't know the syntax of C initializers well enough to judge, but
> I wasn't able to silence the warning by tweaking the code, so far.

I believe the problem is this:

  static union Aligned_Lisp_Subr sname =                                \
     {{{ PVEC_SUBR << PSEUDOVECTOR_AREA_BITS },                         \
       { .a ## maxargs = fnname },                                      \
       minargs, maxargs, lname, {intspec}, 0}};                         \
                                           ^

That zero corresponds to the 'Lisp_Object command_modes' member of
Aligned_Lisp_Subr, and in a build with --enable-check-lisp-object-type
a Lisp_Object is a struct, so it must be initialized with {0}, not
just a scalar zero.  This is what we had before April 2020, when
Andrea removed the braces around the zero in commit d73e6407.

Andrea, can you tell why this was done?  I don't think I understand
how the intent of that changeset justifies the removal.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]