Re: [PATCH] perf/x86/intel: Mark expected switch fall-throughs

From: Miguel Ojeda
Date: Tue Jun 25 2019 - 08:47:44 EST


On Tue, Jun 25, 2019 at 9:19 AM Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
>
> Can it build a kernel without patches yet? That is, why should I care
> what LLVM does?

Having more than a single compiler is always a good idea. You benefit
from more warnings, more tooling, a second implementation for
reference/comparison, etc.

As for what is the current state, I think they are close, specially
for aarch64, but I let Nick, Nathan et. al. answer that! :-) (Cc'd).
They had a talk in FOSDEM 2019 about it, too.

Also CC'ing Luc since he changed sparse to stop ignoring the attribute
so that __has_attribute() would work, but I am not sure if there has
been further work on supporting it properly.

> > Also note that C2x may get [[fallthrough]]. See N2267 and N2335. At
> > that point, surely tools/IDEs/analyzers will support it :-) The
> > question is whether we want to wait that long to replace the comments.
>
> #define __fallthrough [[fallthrough]]
>
> right?

Yes and no. The exact spelling we use does not matter much. My point
with that paragraph was that since C2x will (maybe) add fallthrough,
as C++17 did, every compiler/analyzer/IDE/etc. that is still missing
support for it will have to eventually add it even if they ignore GNU
attributes. At that point, I would guess most will likely add all
spellings too.

Cheers,
Miguel