Commit 1068048e40 for openssl.org
commit 1068048e4054a37272ef7c4535d98860b2131c6c
Author: Milan Broz <gmazyland@gmail.com>
Date: Wed Apr 22 16:05:35 2026 +0200
Fix ignoring return value in RCU witn MINGW 32bit
For code that uses NO_INTERLOCKEDOR64 (Win32 32bit),
there is a warning in RCU code
error: ignoring return value of 'CRYPTO_THREAD_write_lock'
declared with attribute 'warn_unused_result' [-Werror=unused-result]
As the function cannot fail on that platform (and error
path would need some reverts leading to impossible dereference later),
just use trick to silence the warning.
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Thu Apr 30 11:42:34 2026
(Merged from https://github.com/openssl/openssl/pull/30941)
diff --git a/crypto/threads_win.c b/crypto/threads_win.c
index beaf7f0252..33b373f25d 100644
--- a/crypto/threads_win.c
+++ b/crypto/threads_win.c
@@ -340,7 +340,8 @@ static struct rcu_qp *update_qp(CRYPTO_RCU_LOCK *lock, uint32_t *curr_id)
/* update the reader index to be the prior qp */
tmp = lock->current_alloc_idx;
#if (defined(NO_INTERLOCKEDOR64))
- CRYPTO_THREAD_write_lock(lock->rw_lock);
+ /* This cannot fail, avoid unused result warning */
+ ossl_unused int r = CRYPTO_THREAD_write_lock(lock->rw_lock);
lock->reader_idx = tmp;
CRYPTO_THREAD_unlock(lock->rw_lock);
#else