From: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
To: Ramsay Jones <ramsay@ramsayjones.plus.com>
Cc: linux-sparse@vger.kernel.org
Subject: Re: [SPARSE PATCH] univ-init: conditionally accept { 0 } without warnings
Date: Tue, 2 Jun 2020 18:41:58 +0200 [thread overview]
Message-ID: <20200602164158.lovn2dsuc2g74l55@ltop.local> (raw)
In-Reply-To: <2fcda487-733b-8ed1-e1f4-6c6204a68569@ramsayjones.plus.com>
On Wed, May 20, 2020 at 01:22:22AM +0100, Ramsay Jones wrote:
> >
> > diff --git a/parse.c b/parse.c
> > index a29c67c8cf41..48494afc6f2c 100644
> > --- a/parse.c
> > +++ b/parse.c
> > @@ -2750,6 +2750,13 @@ static struct token *initializer_list(struct expression_list **list, struct toke
> > {
> > struct expression *expr;
> >
> > + // '{ 0 }' is equivalent to '{ }' unless wanting all possible
> > + // warnings about using '0' to initialize a null-pointer.
> > + if (!Wuniversal_initializer) {
> > + if (match_token_zero(token) && match_op(token->next, '}'))
> > + token = token->next;
> > + }
> > +
>
> Ha! This made me LOL! (see my patch below).
>
> So simple. (I did think, at first, that deleting the '0' token was
> not a good idea - then I realized that it's more like skipping/ignoring
> the token than deleting it.)
>
> I wish I had thought of it.
Well, it ended that it wasn't that smart after all because it
caused several regressions when used with scalars.
So, I finally had to do a sort of hybrid between your version
(for the parsing) and mine (dropping the '0' element from the list,
but now, later, at evaluation time).
-- Luc
prev parent reply other threads:[~2020-06-02 16:42 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-18 23:54 [SPARSE PATCH] univ-init: conditionally accept { 0 } without warnings Luc Van Oostenryck
2020-05-20 0:22 ` Ramsay Jones
2020-05-20 0:41 ` Đoàn Trần Công Danh
2020-05-20 20:40 ` Luc Van Oostenryck
2020-05-20 22:03 ` Ramsay Jones
2020-06-02 16:41 ` Luc Van Oostenryck [this message]
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200602164158.lovn2dsuc2g74l55@ltop.local \
--to=luc.vanoostenryck@gmail.com \
--cc=linux-sparse@vger.kernel.org \
--cc=ramsay@ramsayjones.plus.com \
/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.
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 NNTP newsgroup(s).