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

From: Nick Desaulniers
Date: Tue Jun 25 2019 - 14:16:24 EST


On Tue, Jun 25, 2019 at 5:47 AM Miguel Ojeda
<miguel.ojeda.sandonis@xxxxxxxxx> wrote:
>
> 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?

Unreleased versions of Clang built from source can; the latest release
of Clang-8 doesn't have asm goto support required for
CONFIG_JUMP_LABEL. Things can get complicated based on which kernel
tree/branch (mainline, -next, stable), arch, and configs, but I think
we just have a few long tail bugs left.

We're currently planning multiple output constraint support w/ asm
goto, and have recently implemented things like
__GCC_ASM_FLAG_OUTPUTS__. If there's other features that we should
start implementing, please let us know.

Give it a shot and let us know what works or doesn't.

For more info, see our
site: https://clangbuiltlinux.github.io/
CI: https://travis-ci.com/ClangBuiltLinux/continuous-integration
Bug tracker: https://github.com/ClangBuiltLinux/linux/issues
wiki: https://github.com/ClangBuiltLinux/linux/wiki

Or reach out to us via
email: clang-built-linux@xxxxxxxxxxxxxxxx
irc: #clangbuiltlinux on chat.freenode.net
or attend our public bi-weekly (once ever 2 weeks, not twice a week) meeting

>
> 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.

Regarding __attribute__((fallthrough)), it's currently a work in
progress in Clang:
https://bugs.llvm.org/show_bug.cgi?id=37135
https://reviews.llvm.org/D63260

--
Thanks,
~Nick Desaulniers