[compiler-rt] bc8e601 - sanitizer: support GCC's fallthrough attribute

Martin Liska via llvm-commits llvm-commits at lists.llvm.org
Tue May 3 02:31:02 PDT 2022


Author: Martin Liska
Date: 2022-05-03T11:30:13+02:00
New Revision: bc8e6012577bab2e94babec965f1ad10172432ec

URL: https://github.com/llvm/llvm-project/commit/bc8e6012577bab2e94babec965f1ad10172432ec
DIFF: https://github.com/llvm/llvm-project/commit/bc8e6012577bab2e94babec965f1ad10172432ec.diff

LOG: sanitizer: support GCC's fallthrough attribute

Fixes:
sanitizer_stack_store.cpp:257:13: warning: this statement may fall through [-Wimplicit-fallthrough=]

when being built with GCC.

Differential Revision: https://reviews.llvm.org/D124832

Added: 
    

Modified: 
    compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h b/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h
index 924578b4409fa..95a80b4629c77 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h
@@ -259,7 +259,9 @@ typedef u64 tid_t;
 # define NOEXCEPT throw()
 #endif
 
-#if __has_cpp_attribute(clang::fallthrough)
+#if __has_cpp_attribute(fallthrough)
+#  define FALLTHROUGH [[fallthrough]]
+#elif __has_cpp_attribute(clang::fallthrough)
 #  define FALLTHROUGH [[clang::fallthrough]]
 #else
 #  define FALLTHROUGH


        


More information about the llvm-commits mailing list