unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: emacs-devel@gnu.org, monnier@iro.umontreal.ca, akrl@sdf.org
Subject: Re: ./configure --enable-check-lisp-object-type
Date: Tue, 12 Apr 2022 21:34:50 +0300	[thread overview]
Message-ID: <83mtgq40c5.fsf@gnu.org> (raw)
In-Reply-To: <874k2ycg2p.fsf@gnus.org> (message from Lars Ingebrigtsen on Tue,  12 Apr 2022 20:27:42 +0200)

> 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	other threads:[~2022-04-12 18:34 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-12 16:58 ./configure --enable-check-lisp-object-type Lars Ingebrigtsen
2022-04-12 17:23 ` Stefan Monnier
2022-04-12 17:43   ` Eli Zaretskii
2022-04-12 18:27     ` Lars Ingebrigtsen
2022-04-12 18:34       ` Eli Zaretskii [this message]
2022-04-12 18:40         ` Lars Ingebrigtsen
2022-04-12 19:05           ` Eli Zaretskii
2022-04-12 22:20             ` Stefan Monnier
2022-04-13  8:47         ` martin rudalics

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83mtgq40c5.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=akrl@sdf.org \
    --cc=emacs-devel@gnu.org \
    --cc=larsi@gnus.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).