linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Cc: Sparse Mailing-list <linux-sparse@vger.kernel.org>
Subject: Re: [PATCH] handle qualified anonymous structures
Date: Fri, 22 Jan 2021 09:35:43 -0800	[thread overview]
Message-ID: <CAHk-=wj3v1hm3x0x_3ui1PQDLbn7V5PoxGyDf_UB6TCxMTgjQw@mail.gmail.com> (raw)
In-Reply-To: <20210122162625.73007-1-luc.vanoostenryck@gmail.com>

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.

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.

Hmm?

Anyway, looks good, and obviously passes my trivial test-case.

               Linus

  reply	other threads:[~2021-01-22 17:41 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 [this message]
2021-01-22 18:01     ` Linus Torvalds
2021-01-22 20:11       ` Luc Van Oostenryck
2021-01-22 19:38     ` Luc Van Oostenryck

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='CAHk-=wj3v1hm3x0x_3ui1PQDLbn7V5PoxGyDf_UB6TCxMTgjQw@mail.gmail.com' \
    --to=torvalds@linux-foundation.org \
    --cc=linux-sparse@vger.kernel.org \
    --cc=luc.vanoostenryck@gmail.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).