linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Sparse Mailing-list <linux-sparse@vger.kernel.org>,
	Peter Zijlstra <peterz@infradead.org>
Subject: Re: [PATCH] casts should drop qualifiers
Date: Wed, 18 Nov 2020 22:30:27 +0100	[thread overview]
Message-ID: <20201118213027.3o74il23b5nesx3d@ltop.local> (raw)
In-Reply-To: <CAHk-=wjB+c+1ykVzRz5yKX486hHNMMNVAhrwwvbRuuo9eO5gfg@mail.gmail.com>

On Wed, Nov 18, 2020 at 11:51:00AM -0800, Linus Torvalds wrote:
> On Wed, Nov 18, 2020 at 11:17 AM Luc Van Oostenryck
> <luc.vanoostenryck@gmail.com> wrote:
> >
> > I don't think it's a good idea. The focus now is all about dropping
> > the qualifiers but in code like:
> >         const int x;
> >         typeof(c) y;
> > don't we want 'y' to also have the type 'const int'?
> 
> I assume you meant "typeof(x)". But yes, absolutely.

Yes, sure.
 
> Which is why my suggested example patch had that explicit test for
> "is_lvalue()".  So only for non-lvalues would it strip the qualifiers.
> 
> So "typeof(((void)0,x)) y;" would be "int", because that expression
> inside the typeof isn't an lvalue.

Oh yes, sorry. For some reasons I had things upside down.
 
> But if you have something that is already doing the generic case, then
> that's obviously better. My suggestion was more of a "we can zero in
> on just that typeof case" thing.

I just sent the series but it's not generic.

If I read the standard correctly (big 'if'), in:
	volatile int x;
	typeof(++x) y;
'y' should have the type 'volatile int' and GCC interpret it so.

-- Luc

  reply	other threads:[~2020-11-18 21:30 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1605437478.5370.9.camel@med.uni-goettingen.de>
     [not found] ` <CAFiYyc1-qtU+4Tj3mkz=c608zeP8feyuD6UyRhQv19qjKjJcvg@mail.gmail.com>
     [not found]   ` <20201116111056.GA3121378@hirez.programming.kicks-ass.net>
     [not found]     ` <CAHk-=wh_kn11vXfi2Ns8E4F0GgmUprQtD-=RnU6Eg+N7coY5gw@mail.gmail.com>
2020-11-17 19:47       ` Re: typeof and operands in named address spaces Linus Torvalds
2020-11-17 21:28         ` [PATCH] casts should drop qualifiers Luc Van Oostenryck
2020-11-17 23:22           ` Linus Torvalds
2020-11-17 23:50             ` Luc Van Oostenryck
2020-11-18 18:31             ` Linus Torvalds
2020-11-18 19:17               ` Luc Van Oostenryck
2020-11-18 19:51                 ` Linus Torvalds
2020-11-18 21:30                   ` Luc Van Oostenryck [this message]
2020-11-19  0:58                     ` Linus Torvalds
2020-11-19  8:11                       ` 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=20201118213027.3o74il23b5nesx3d@ltop.local \
    --to=luc.vanoostenryck@gmail.com \
    --cc=linux-sparse@vger.kernel.org \
    --cc=peterz@infradead.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).