[PATCH] D66487: Fix -Wimplicit-fallthrough warnings in regcomp.c
Aaron Ballman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 20 13:37:13 PDT 2019
aaron.ballman added inline comments.
================
Comment at: llvm/include/llvm/Support/Compiler.h:257-264
#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
+ #if __has_attribute(fallthrough)
+ #define LLVM_FALLTHROUGH __attribute__((fallthorugh))
+ #else
+ #define LLVM_FALLTHROUGH
----------------
I think this may be better expressed as:
```
...
#elif __has_cpp_attribute(clang::fallthrough)
#define LLVM_FALLTHROUGH [[clang::fallthrough]]
#elif !defined(__cplusplus) && __has_attribute(fallthrough)
#define LLVM_FALLTHROUGH __attribute__((fallthrough))
#else
#define LLVM_FALLTHROUGH
#endif
```
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D66487/new/
https://reviews.llvm.org/D66487
More information about the llvm-commits
mailing list