Disable `-Wcast-function-type-strict` for `BORINGSSL_DEFINE_STACK_OF_IMPL.`
Change-Id: I8340cf9259de72792a01049ecc36997233887006
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/67607
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: David Benjamin <davidben@google.com>
diff --git a/include/openssl/base.h b/include/openssl/base.h
index 57095d0..29b598e 100644
--- a/include/openssl/base.h
+++ b/include/openssl/base.h
@@ -181,6 +181,13 @@
#define OPENSSL_PRINTF_FORMAT_FUNC(string_index, first_to_check)
#endif
+// OPENSSL_CLANG_PRAGMA emits a pragma on clang and nothing on other compilers.
+#if defined(__clang__)
+#define OPENSSL_CLANG_PRAGMA(arg) _Pragma(arg)
+#else
+#define OPENSSL_CLANG_PRAGMA(arg)
+#endif
+
// OPENSSL_MSVC_PRAGMA emits a pragma on MSVC and nothing on other compilers.
#if defined(_MSC_VER)
#define OPENSSL_MSVC_PRAGMA(arg) __pragma(arg)
diff --git a/include/openssl/stack.h b/include/openssl/stack.h
index 46ced49..0eccb2f 100644
--- a/include/openssl/stack.h
+++ b/include/openssl/stack.h
@@ -402,6 +402,9 @@
* positive warning. */ \
OPENSSL_MSVC_PRAGMA(warning(push)) \
OPENSSL_MSVC_PRAGMA(warning(disable : 4191)) \
+ OPENSSL_CLANG_PRAGMA("clang diagnostic push") \
+ OPENSSL_CLANG_PRAGMA("clang diagnostic ignored \"-Wunknown-warning-option\"") \
+ OPENSSL_CLANG_PRAGMA("clang diagnostic ignored \"-Wcast-function-type-strict\"") \
\
DECLARE_STACK_OF(name) \
\
@@ -537,6 +540,7 @@
(OPENSSL_sk_free_func)free_func); \
} \
\
+ OPENSSL_CLANG_PRAGMA("clang diagnostic pop") \
OPENSSL_MSVC_PRAGMA(warning(pop))