Add Fallthru support for clang 10. clang has gained supoprted for __attribute__ ((fallthrough)) in https://reviews.llvm.org/rL369414. Detect the support in clang and enable it as OPENSSL_FALLTHROUGH. This is needed to fix ToT clang builds. Bug: chromium:997709 Test: CQ Change-Id: Iefa17687f6b5e8c95f359f167e9049d9a69c5302 Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/37244 Reviewed-by: David Benjamin <davidben@google.com> Commit-Queue: David Benjamin <davidben@google.com>
diff --git a/crypto/internal.h b/crypto/internal.h index 76a317a..3c682e8 100644 --- a/crypto/internal.h +++ b/crypto/internal.h
@@ -187,6 +187,12 @@ #define OPENSSL_FALLTHROUGH [[gnu::fallthrough]] #elif defined(__GNUC__) && __GNUC__ >= 7 // gcc 7 #define OPENSSL_FALLTHROUGH __attribute__ ((fallthrough)) +#elif defined(__clang__) +#if __has_attribute(fallthrough) +#define OPENSSL_FALLTHROUGH __attribute__ ((fallthrough)) +#else // clang versions that do not support fallthrough. +#define OPENSSL_FALLTHROUGH +#endif #else // C++11 on gcc 6, and all other cases #define OPENSSL_FALLTHROUGH #endif