llvm.org GIT mirror llvm / b62f430
[Support/Compiler.h] - Use gnu::fallthrough for LLVM_FALLTHROUGH when available. I tried to compile LLD using GCC 7.1.0 and got warnings like "warning: this statement may fall through [-Wimplicit-fallthrough=]" (some more details are here: D32907) GCC's __cplusplus value is 201402L by default, so macro expands to nothing, though GCC 7 has support for [[fallthrough]]. Patch uses gnu::fallthrough when it is available and fixes warning I am observing. Initial idea of way to fix belongs to Davide Italiano. Differential revision: https://reviews.llvm.org/D33036 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302878 91177308-0d34-0410-b5e6-96231b3b80d8 George Rimar 3 years ago
1 changed file(s) with 2 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
226226 /// LLVM_FALLTHROUGH - Mark fallthrough cases in switch statements.
227227 #if __cplusplus > 201402L && __has_cpp_attribute(fallthrough)
228228 #define LLVM_FALLTHROUGH [[fallthrough]]
229 #elif __has_cpp_attribute(gnu::fallthrough)
230 #define LLVM_FALLTHROUGH [[gnu::fallthrough]]
229231 #elif !__cplusplus
230232 // Workaround for llvm.org/PR23435, since clang 3.6 and below emit a spurious
231233 // error when __has_cpp_attribute is given a scoped attribute in C mode.