[llvm-dev] RFC Enable -Wimplicit-fallthrough for clang as well as GCC
Mikael Holmén via llvm-dev
llvm-dev at lists.llvm.org
Wed Nov 7 05:26:55 PST 2018
Hi,
Does this mean that the clang version mentioned on
https://llvm.org/docs/GettingStarted.html#host-c-toolchain-both-compiler-and-standard-library
should be updated since it currently says that 3.1 is ok?
I noticed that one of our build-bots that ran clang 3.5.0 failed since
it ended up in the
#define LLVM_FALLTHROUGH
part of the ifdefs in include/llvm/Demangle/Compiler.h
#if __cplusplus > 201402L && __has_cpp_attribute(fallthrough)
#define LLVM_FALLTHROUGH [[fallthrough]]
#elif __has_cpp_attribute(gnu::fallthrough)
#define LLVM_FALLTHROUGH [[gnu::fallthrough]]
#elif !__cplusplus
// Workaround for llvm.org/PR23435, since clang 3.6 and below emit a
spurious
// error when __has_cpp_attribute is given a scoped attribute in C mode.
#define LLVM_FALLTHROUGH
#elif __has_cpp_attribute(clang::fallthrough)
#define LLVM_FALLTHROUGH [[clang::fallthrough]]
#else
#define LLVM_FALLTHROUGH
#endif
and then we of course got tons of fallthrough warnings/errors (with
-Werror).
Now we've updated the clang version on that build bot too, so it's no
problem for us, but perhaps someone else will hit the same thing.
/Mikael
On 11/1/18 9:34 PM, Reid Kleckner via llvm-dev wrote:
> I split all the possible behavior changes out of the big cleanup patch,
> and committed the cleanup as r345882.
>
> I enabled the warning in r345887, and I'll see if it sticks.
>
> Thanks for the reviews!
>
> On Thu, Nov 1, 2018 at 10:25 AM Reid Kleckner <rnk at google.com
> <mailto:rnk at google.com>> wrote:
>
> Great! Thanks everyone for the input, I'm going to start splitting
> up the patch. I'll send out the non-mechanical parts separately.
>
> On Wed, Oct 31, 2018 at 10:03 PM Chris Lattner <sabre at nondot.org
> <mailto:sabre at nondot.org>> wrote:
>
> On Oct 31, 2018, at 2:24 PM, Reid Kleckner <rnk at google.com
> <mailto:rnk at google.com>> wrote:
>> Alex Kornienko proposed enabling this warning back in 2012 here:
>> http://lists.llvm.org/pipermail/llvm-dev/2012-July/051386.html
>>
>> At the time, Chris Lattner said he didn't feel it was worth
>> annotating
>> all of LLVM and Clang with a new macro to enable this warning.
>
> FWIW, I formally withdraw my objection, go for it! :-)
>
> -Chris
>
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
More information about the llvm-dev
mailing list