From b5e0c5bfe804c27f89568a9f9f6ab92ad83e4a65 Mon Sep 17 00:00:00 2001 From: "Earle F. Philhower, III" Date: Sun, 2 Aug 2020 13:20:31 -0700 Subject: [PATCH] Remove warnings when buinding NoAssert Parameters that are only used in an assert() statement are unused when the NoAssert-NDEBUG option is used. This causes the following unused parameter warnings while building: ```` /home/earle/Arduino/hardware/esp8266com/esp8266/cores/esp8266/Crypto.cpp: In function 'String {anonymous}::createBearsslHmac(const br_hash_class*, uint8_t, const String&, const void*, size_t, size_t)': /home/earle/Arduino/hardware/esp8266com/esp8266/cores/esp8266/Crypto.cpp:101:71: warning: unused parameter 'hashTypeNaturalLength' [-Wunused-parameter] 101 | String createBearsslHmac(const br_hash_class *hashType, const uint8_t hashTypeNaturalLength, const String &message, const void *hashKey, const size_t hashKeyLength, const size_t hmacLength) | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~ /home/earle/Arduino/hardware/esp8266com/esp8266/cores/esp8266/Crypto.cpp: In function 'String {anonymous}::createBearsslHmacCT(const br_hash_class*, uint8_t, const String&, const void*, size_t, size_t)': /home/earle/Arduino/hardware/esp8266com/esp8266/cores/esp8266/Crypto.cpp:153:73: warning: unused parameter 'hashTypeNaturalLength' [-Wunused-parameter] 153 | String createBearsslHmacCT(const br_hash_class *hashType, const uint8_t hashTypeNaturalLength, const String &message, const void *hashKey, const size_t hashKeyLength, const size_t hmacLength) | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~ ```` Mark them unused in the code to avoid the error. The assert() still works. --- cores/esp8266/Crypto.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cores/esp8266/Crypto.cpp b/cores/esp8266/Crypto.cpp index ae396b7d0b..6f9009d56d 100644 --- a/cores/esp8266/Crypto.cpp +++ b/cores/esp8266/Crypto.cpp @@ -100,6 +100,7 @@ void *createBearsslHmac(const br_hash_class *hashType, const void *data, const s String createBearsslHmac(const br_hash_class *hashType, const uint8_t hashTypeNaturalLength, const String &message, const void *hashKey, const size_t hashKeyLength, const size_t hmacLength) { + (void) hashTypeNaturalLength; assert(1 <= hmacLength && hmacLength <= hashTypeNaturalLength); uint8_t hmac[hmacLength]; @@ -152,6 +153,7 @@ void *createBearsslHmacCT(const br_hash_class *hashType, const void *data, const String createBearsslHmacCT(const br_hash_class *hashType, const uint8_t hashTypeNaturalLength, const String &message, const void *hashKey, const size_t hashKeyLength, const size_t hmacLength) { + (void) hashTypeNaturalLength; assert(1 <= hmacLength && hmacLength <= hashTypeNaturalLength); uint8_t hmac[hmacLength];