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 21:34:50 +0300

> From: Lars Ingebrigtsen <larsi@gnus.org>
> Cc: Stefan Monnier <monnier@iro.umontreal.ca>,  Andrea Corallo
>  <akrl@sdf.org>,  emacs-devel@gnu.org
> Date: Tue, 12 Apr 2022 20:27:42 +0200
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > 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.
> 
> I can confirm that adding braces around the zero makes these warnings go
> away.
> 
> There's similar warnings in alloc:
> 
> alloc.c: In function 'syms_of_alloc':
> alloc.c:7838:6: warning: missing braces around initializer [-Wmissing-braces]
>  7838 |      {{{ PSEUDOVECTOR_FLAG | (PVEC_SUBR << PSEUDOVECTOR_AREA_BITS) },
>       |      ^
>  7839 |        { .a4 = watch_gc_cons_threshold },
>  7840 |        4, 4, "watch_gc_cons_threshold", {0}, 0}};
>       |                                              {}
> 
> And adding braces around the zero does the trick there, too.

And if you build without --enable-check-lisp-object-type, does it
compile cleanly with the additional braces?

> There's still a number of other warnings which may or may not be valid
> (I haven't actually looked at them):
> 
> In file included from dbusbind.c:26:
> dbusbind.c: In function 'xd_signature':
> lisp.h:409:38: warning: potential null pointer dereference 
> [-Wnull-dereference]
>   409 | #define lisp_h_XCAR(c) XCONS (c)->u.s.car
>       |                        ~~~~~~~~~~~~~~^~~~
> lisp.h:1498:10: note: in expansion of macro 'lisp_h_XCAR'
>  1498 |   return lisp_h_XCAR (c);
>       |          ^~~~~~~~~~~
> lisp.h:409:38: warning: potential null pointer dereference 
> [-Wnull-dereference]
>   409 | #define lisp_h_XCAR(c) XCONS (c)->u.s.car
>       |                        ~~~~~~~~~~~~~~^~~~

I don't think this is related, it might be that defining Lisp_Object
as a struct makes it easier (or harder) for the compiler to reason
about the control flow.

> Is the --enable-check-lisp-object-type build supposed to be without
> warnings, or has that never been the ambition?

It's supposed to be as clean as without that option, yes.  It just
seems that this option is rarely used, so it has bitrotted to some
extent.



reply via email to

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