diff options
Diffstat (limited to 'Source/WTF/wtf/Compiler.h')
-rw-r--r-- | Source/WTF/wtf/Compiler.h | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/Source/WTF/wtf/Compiler.h b/Source/WTF/wtf/Compiler.h index 89f4ca42e..f74fc8a0d 100644 --- a/Source/WTF/wtf/Compiler.h +++ b/Source/WTF/wtf/Compiler.h @@ -52,7 +52,6 @@ #define WTF_COMPILER_SUPPORTS_C_STATIC_ASSERT __has_feature(c_static_assert) #define WTF_COMPILER_SUPPORTS_CXX_REFERENCE_QUALIFIED_FUNCTIONS __has_feature(cxx_reference_qualified_functions) #define WTF_COMPILER_SUPPORTS_CXX_USER_LITERALS __has_feature(cxx_user_literals) -#define WTF_COMPILER_SUPPORTS_FALLTHROUGH_WARNINGS __has_feature(cxx_attributes) && __has_warning("-Wimplicit-fallthrough") #endif /* COMPILER(GCC_OR_CLANG) - GNU Compiler Collection or Clang */ @@ -176,10 +175,18 @@ /* FALLTHROUGH */ -#if !defined(FALLTHROUGH) && COMPILER_SUPPORTS(FALLTHROUGH_WARNINGS) && COMPILER(CLANG) +#if !defined(FALLTHROUGH) && defined(__cplusplus) && defined(__has_cpp_attribute) + +#if __has_cpp_attribute(fallthrough) +#define FALLTHROUGH [[fallthrough]] +#elif __has_cpp_attribute(clang::fallthrough) #define FALLTHROUGH [[clang::fallthrough]] +#elif __has_cpp_attribute(gnu::fallthrough) +#define FALLTHROUGH [[gnu::fallthrough]] #endif +#endif // !defined(FALLTHROUGH) && defined(__cplusplus) && defined(__has_cpp_attribute) + #if !defined(FALLTHROUGH) #define FALLTHROUGH #endif |