From: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Sparse Mailing-list <linux-sparse@vger.kernel.org>
Subject: Re: [PATCH] handle qualified anonymous structures
Date: Fri, 22 Jan 2021 20:38:19 +0100 [thread overview]
Message-ID: <20210122193819.x5f2teyaw3ve4m7x@mail> (raw)
In-Reply-To: <CAHk-=wj3v1hm3x0x_3ui1PQDLbn7V5PoxGyDf_UB6TCxMTgjQw@mail.gmail.com>
On Fri, Jan 22, 2021 at 09:35:43AM -0800, Linus Torvalds wrote:
> On Fri, Jan 22, 2021 at 8:26 AM Luc Van Oostenryck
> <luc.vanoostenryck@gmail.com> wrote:
> >
> > So, the solution chosen here is to handle this during type examination,
> > more precisely, inside examine_struct_union_type(), where things are
> > a bit more complicated
>
> Well, doesn't look all that complicated to me.
>
> The only thing I would do is to just at the head of that function do:
>
> unsigned long mod = sym->ctype.modifiers & MOD_QUALIFIER;
>
> if (!mod)
> return;
>
> and that also means that you can avoid the "parent-vs-sym" thing,
> because the symbol is never used after that, so you don't need to
> create a new one.
Yes, certainly since the vast majority will have a null mod.
> The other thing that might be worth doing is to just make sure that
> the "sub" whose modifier you change is always a SYM_NODE. We never
> want to touch an actual type, only the node.
>
> I don't think it _can_ be anything else (that's how the struct/union
> symbol_list should be set up), but since this is a very unusual case
> of going back and modifying a symbol after the fact, I think I'd be a
> bit more comfortable with that kind of sanity check.
Yes, I agree.
I fact I almost did this but hen I said "why bother? it's always a NODE
anyway". But sure, it's cheap and better be safe than sorry.
> Anyway, looks good, and obviously passes my trivial test-case.
Thank you.
-- Luc
prev parent reply other threads:[~2021-01-22 23:08 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-20 19:21 'const' unnamed structures Linus Torvalds
2021-01-20 22:55 ` Luc Van Oostenryck
2021-01-22 16:26 ` [PATCH] handle qualified anonymous structures Luc Van Oostenryck
2021-01-22 17:35 ` Linus Torvalds
2021-01-22 18:01 ` Linus Torvalds
2021-01-22 20:11 ` Luc Van Oostenryck
2021-01-22 19:38 ` 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=20210122193819.x5f2teyaw3ve4m7x@mail \
--to=luc.vanoostenryck@gmail.com \
--cc=linux-sparse@vger.kernel.org \
--cc=torvalds@linux-foundation.org \
/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).