Kicad Curl: Ignore unused functions for OpenSSL >= 1.1.0

In OpenSSL 1.1.0 and newer, the locking callback macros do nothing.
This causes unused warnings for the static function lock_callback.

Ignore this function on newer OpenSSL builds, but keep
the infrastructure for now.

When OpenSSL's min version is 1.1 or greater, all the locking
infrastructure can be removed.
This commit is contained in:
John Beard 2019-04-18 16:15:19 +01:00
parent 02fca8e0df
commit 6ad97e5b5b
1 changed files with 22 additions and 0 deletions

View File

@ -46,6 +46,23 @@ static MUTEX s_lock; // for s_initialized
static MUTEX* s_crypto_locks; static MUTEX* s_crypto_locks;
/*
* From OpenSSL v1.1.0, the CRYPTO_set_locking_callback macro is a no-op.
*
* Once this is the minimum OpenSSL version, the entire s_crypto_locks
* system and related functions can be removed.
*
* In the meantime, use this macro to determine when to use the callback.
* Keep them compiling until then to prevent accidentally breaking older
* version builds.
*
* https://github.com/openssl/openssl/issues/1260
*/
#if OPENSSL_VERSION_NUMBER < 0x10100000L
#define USE_OPENSSL_LOCKING_CALLBACKS
#endif
static void lock_callback( int mode, int type, const char* file, int line ) static void lock_callback( int mode, int type, const char* file, int line )
{ {
(void)file; (void)file;
@ -98,6 +115,11 @@ static void init_locks()
*/ */
CRYPTO_set_locking_callback( &lock_callback ); CRYPTO_set_locking_callback( &lock_callback );
#ifndef USE_OPENSSL_LOCKING_CALLBACKS
// Ignore the unused function (the above macro didn't use it)
(void) &lock_callback;
#endif
} }