Skip to content

Commit fc1aa55

Browse files
Remove warnings when buinding NoAssert (#7499)
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.
1 parent 3be0cbb commit fc1aa55

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

cores/esp8266/Crypto.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ void *createBearsslHmac(const br_hash_class *hashType, const void *data, const s
100100

101101
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)
102102
{
103+
(void) hashTypeNaturalLength;
103104
assert(1 <= hmacLength && hmacLength <= hashTypeNaturalLength);
104105

105106
uint8_t hmac[hmacLength];
@@ -152,6 +153,7 @@ void *createBearsslHmacCT(const br_hash_class *hashType, const void *data, const
152153

153154
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)
154155
{
156+
(void) hashTypeNaturalLength;
155157
assert(1 <= hmacLength && hmacLength <= hashTypeNaturalLength);
156158

157159
uint8_t hmac[hmacLength];

0 commit comments

Comments
 (0)