From d9204aa70d4676a744a1e2ba1df6de988147319c Mon Sep 17 00:00:00 2001 From: "Earle F. Philhower, III" Date: Thu, 18 Jan 2018 19:25:37 -0800 Subject: [PATCH] Remove warnings when NDEBUG build option used When building using the new NDEBUG option recently added, the assert() macro is defined to nothing. This leaves a few variables unused in the WiFi stack causing compiler warnings. Add in empty casts to remove these warnings. Does not affect actual assert use when NDEBUG is not defined. --- libraries/ESP8266WiFi/src/include/ClientContext.h | 1 + libraries/ESP8266WiFi/src/include/DataSource.h | 3 +++ 2 files changed, 4 insertions(+) diff --git a/libraries/ESP8266WiFi/src/include/ClientContext.h b/libraries/ESP8266WiFi/src/include/ClientContext.h index 43e9040a48..6a682747eb 100644 --- a/libraries/ESP8266WiFi/src/include/ClientContext.h +++ b/libraries/ESP8266WiFi/src/include/ClientContext.h @@ -543,6 +543,7 @@ class ClientContext err_t _connected(struct tcp_pcb *pcb, err_t err) { (void) err; + (void) pcb; assert(pcb == _pcb); assert(_connect_pending); esp_schedule(); diff --git a/libraries/ESP8266WiFi/src/include/DataSource.h b/libraries/ESP8266WiFi/src/include/DataSource.h index 77eb78b676..7f399a0584 100644 --- a/libraries/ESP8266WiFi/src/include/DataSource.h +++ b/libraries/ESP8266WiFi/src/include/DataSource.h @@ -31,12 +31,14 @@ class BufferDataSource : public DataSource { const uint8_t* get_buffer(size_t size) override { + (void) size; assert(_pos + size <= _size); return _data + _pos; } void release_buffer(const uint8_t* buffer, size_t size) override { + (void) buffer; assert(buffer == _data + _pos); _pos += size; } @@ -70,6 +72,7 @@ class BufferedStreamDataSource : public DataSource { } size_t cb = _stream.readBytes(reinterpret_cast(_buffer.get()), size); assert(cb == size); + (void) cb; return _buffer.get(); }