Resolve -Wextern-c-compat warnings with OPENSSL_NO_THREADS.
C and C++ disagree on the sizes of empty structs, which can be rather bad for structs embedded in public headers. Stick a char in them to avoid issues. (It doesn't really matter for CRYPTO_STATIC_MUTEX, but it's easier to add a char in there too.) Thanks to Andrew Chi for reporting this issue. Change-Id: Ic54fff710b688decaa94848e9c7e1e73f0c58fd3 Reviewed-on: https://boringssl-review.googlesource.com/7760 Reviewed-by: David Benjamin <davidben@google.com>
This commit is contained in:
parent
ede2e2c5ce
commit
c25d2e6379
@ -353,7 +353,9 @@ OPENSSL_EXPORT int CRYPTO_refcount_dec_and_test_zero(CRYPTO_refcount_t *count);
|
||||
* automatically by |CRYPTO_STATIC_MUTEX_lock_*|. */
|
||||
|
||||
#if defined(OPENSSL_NO_THREADS)
|
||||
struct CRYPTO_STATIC_MUTEX {};
|
||||
struct CRYPTO_STATIC_MUTEX {
|
||||
char padding; /* Empty structs have different sizes in C and C++. */
|
||||
};
|
||||
#define CRYPTO_STATIC_MUTEX_INIT {}
|
||||
#elif defined(OPENSSL_WINDOWS)
|
||||
struct CRYPTO_STATIC_MUTEX {
|
||||
|
@ -67,7 +67,9 @@ extern "C" {
|
||||
|
||||
|
||||
#if defined(OPENSSL_NO_THREADS)
|
||||
typedef struct crypto_mutex_st {} CRYPTO_MUTEX;
|
||||
typedef struct crypto_mutex_st {
|
||||
char padding; /* Empty structs have different sizes in C and C++. */
|
||||
} CRYPTO_MUTEX;
|
||||
#elif defined(OPENSSL_WINDOWS)
|
||||
/* CRYPTO_MUTEX can appear in public header files so we really don't want to
|
||||
* pull in windows.h. It's statically asserted that this structure is large
|
||||
|
Loading…
Reference in New Issue
Block a user