mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
To: Marco Elver <elver@google.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	linux-kernel@vger.kernel.org, Borislav Petkov <bp@suse.de>,
	Will Deacon <will@kernel.org>
Subject: Re: [PATCH] sparse: use the _Generic() version of __unqual_scalar_typeof()
Date: Fri, 19 Jun 2020 16:12:37 +0200	[thread overview]
Message-ID: <20200619141237.onwjhjbc7ni7rrev@ltop.local> (raw)
In-Reply-To: <20200619095105.GA222848@elver.google.com>

On Fri, Jun 19, 2020 at 11:51:05AM +0200, Marco Elver wrote:
> On Fri, Jun 19, 2020 at 12:26AM +0200, Luc Van Oostenryck wrote:
> > If the file is being checked with sparse, use the version of
> > __unqual_scalar_typeof() using _Generic(), leaving the unoptimized
> > version only for the oldest versions of GCC.
> > 
> > This reverts commit
> >   b398ace5d2ea ("compiler_types.h: Use unoptimized __unqual_scalar_typeof for sparse")
> > 
> > Note: a recent version of sparse will be needed (minimum v0.6.2-rc2
> >        or later than 2020-05-28).
> > 
> > Cc: Marco Elver <elver@google.com>
> > Cc: Borislav Petkov <bp@suse.de>
> > Cc: Will Deacon <will@kernel.org>
> > Link: https://marc.info/?l=linux-sparse&m=159233481816454
> > Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
> 
> Definitely support this change, so in principle:
> 
> 	Acked-by: Marco Elver <elver@google.com>
> 
> But, I think sparse still isn't entirely happy with all legal uses of
> _Generic. Running latest sparse on:

Indeed.

> Whereas GCC or Clang accept this as expected. I can't find the
> standardese right now, but in [1] we have:
> 
> 	"[...] The conversion is performed in type domain only: it
> 	discards the top-level cvr-qualifiers and atomicity and applies
> 	array-to-pointer/function-to-pointer transformations to the type
> 	of the controlling expression [...]"
> 
> [1] https://en.cppreference.com/w/c/language/generic

Yes, these are the rules following the resolution of DR481, which
are now used for C17 and also by gcc & clang for C11 but were not
present the C11 standard.

This should be fixed now but I'm waiting for the tests results.

Thanks for reporting this.
-- Luc

  reply	other threads:[~2020-06-19 14:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-18 22:26 Luc Van Oostenryck
2020-06-19  8:23 ` Will Deacon
2020-06-19  9:51 ` Marco Elver
2020-06-19 14:12   ` Luc Van Oostenryck [this message]
2020-06-19 18:26 ` Linus Torvalds
2020-06-19 19:08   ` Luc Van Oostenryck
2020-06-20  4:32 ` kernel test robot
2020-07-08 19:02 ` Linus Torvalds

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=20200619141237.onwjhjbc7ni7rrev@ltop.local \
    --to=luc.vanoostenryck@gmail.com \
    --cc=bp@suse.de \
    --cc=elver@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=will@kernel.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

all inboxes | Powered by JetHome®