From 55e0fc8df9c4045453982888732a0dd7c99ea6d1 Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Tue, 5 Apr 2022 13:23:12 +0200 Subject: [PATCH 1/2] refactor: Drop unneeded workarounds aimed to silence unused warning All of the touched symbols are indeed used regardless of any macros. --- src/crypto/sha256.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/crypto/sha256.cpp b/src/crypto/sha256.cpp index cde543e68c..9e7212020c 100644 --- a/src/crypto/sha256.cpp +++ b/src/crypto/sha256.cpp @@ -590,10 +590,6 @@ std::string SHA256AutoDetect() bool have_x86_shani = false; bool enabled_avx = false; - (void)AVXEnabled; - (void)have_sse4; - (void)have_avx; - (void)have_xsave; (void)have_avx2; (void)have_x86_shani; (void)enabled_avx; @@ -641,7 +637,7 @@ std::string SHA256AutoDetect() ret += ",avx2(8way)"; } #endif -#endif +#endif // defined(USE_ASM) && defined(HAVE_GETCPUID) #if defined(ENABLE_ARM_SHANI) && !defined(BUILD_BITCOIN_INTERNAL) bool have_arm_shani = false; From 07ddecb84e6097684fa56cfc79c8c2aad76f6604 Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Tue, 5 Apr 2022 13:52:13 +0200 Subject: [PATCH 2/2] refactor: Use [[maybe_unused]] attribute --- src/crypto/sha256.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/crypto/sha256.cpp b/src/crypto/sha256.cpp index 9e7212020c..196f81ea16 100644 --- a/src/crypto/sha256.cpp +++ b/src/crypto/sha256.cpp @@ -586,13 +586,9 @@ std::string SHA256AutoDetect() bool have_sse4 = false; bool have_xsave = false; bool have_avx = false; - bool have_avx2 = false; - bool have_x86_shani = false; - bool enabled_avx = false; - - (void)have_avx2; - (void)have_x86_shani; - (void)enabled_avx; + [[maybe_unused]] bool have_avx2 = false; + [[maybe_unused]] bool have_x86_shani = false; + [[maybe_unused]] bool enabled_avx = false; uint32_t eax, ebx, ecx, edx; GetCPUID(1, 0, eax, ebx, ecx, edx);