[compiler-rt] a44a873 - sanitizer_common: add FALLTHROUGH macro
Dmitry Vyukov via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 10 11:04:41 PDT 2021
Author: Dmitry Vyukov
Date: 2021-08-10T20:04:37+02:00
New Revision: a44a873e11de99a6e31609f8f6075e0c46eb7006
URL: https://github.com/llvm/llvm-project/commit/a44a873e11de99a6e31609f8f6075e0c46eb7006
DIFF: https://github.com/llvm/llvm-project/commit/a44a873e11de99a6e31609f8f6075e0c46eb7006.diff
LOG: sanitizer_common: add FALLTHROUGH macro
Add FALLTHROUGH portably defined to [[clang::fallthrough]].
We have -Wimplicit-fallthrough already enabled, and currently
it's not possible to fix the warning.
Depends on D107735.
Reviewed By: melver
Differential Revision: https://reviews.llvm.org/D107736
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 e8de3932a619..f7fdc160eeb1 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h
@@ -125,6 +125,10 @@
# define __has_attribute(x) 0
#endif
+#if !defined(__has_cpp_attribute)
+# define __has_cpp_attribute(x) 0
+#endif
+
// For portability reasons we do not include stddef.h, stdint.h or any other
// system header, but we do need some basic types that are not defined
// in a portable way by the language itself.
@@ -250,6 +254,12 @@ typedef u64 tid_t;
# define NOEXCEPT throw()
#endif
+#if __has_cpp_attribute(clang::fallthrough)
+# define FALLTHROUGH [[clang::fallthrough]]
+#else
+# define FALLTHROUGH
+#endif
+
// Unaligned versions of basic types.
typedef ALIGNED(1) u16 uu16;
typedef ALIGNED(1) u32 uu32;
More information about the llvm-commits
mailing list