Commit ba5e39ac92addf5d2183ac4ceb66ab52c59c017b

Patrick Steinhardt 2018-05-04T15:25:11

streams: openssl: fix bogus warning on unused parameter Our provided callback function `threadid_cb(CRYPTO_THREADID *threadid)` sets up a unique thread ID by asking pthread for the current thread ID. Since openssl version 1.1, `CRYPTO_THREADID_set_numeric` is simply a no-op macro, leaving the `threadid` argument unused after the preprocessor has processed the macro. GCC does not account for that situation and will thus complain about `threadid` being unused. Silence this warning by using `GIT_UNUSED(threadid)`.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
diff --git a/src/streams/openssl.c b/src/streams/openssl.c
index d1bcbf2..8cce844 100644
--- a/src/streams/openssl.c
+++ b/src/streams/openssl.c
@@ -252,7 +252,8 @@ int git_openssl_stream_global_init(void)
 #if defined(GIT_THREADS)
 static void threadid_cb(CRYPTO_THREADID *threadid)
 {
-    CRYPTO_THREADID_set_numeric(threadid, git_thread_currentid());
+	GIT_UNUSED(threadid);
+	CRYPTO_THREADID_set_numeric(threadid, git_thread_currentid());
 }
 #endif