1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-12 01:53:07 +03:00

Fix warnings (#2881)

* Suppressed -Wunused-parameter and -Wunused-function by casting to void unused identifiers.

* Explicit initialization of all fields to suppress -Wmissing-field-initializers.

* Fixed signed/unsigned integer comparison.

* memset initialization of structs.

* More -Wunused-parameter fixes.
This commit is contained in:
Rodion Kvashnin
2017-01-31 13:07:59 +06:00
committed by Ivan Grokhotkov
parent d85e783806
commit 2126146e20
27 changed files with 92 additions and 12 deletions

View File

@ -153,6 +153,7 @@ WiFiEventHandler ESP8266WiFiGenericClass::onStationModeGotIP(std::function<void(
WiFiEventHandler ESP8266WiFiGenericClass::onStationModeDHCPTimeout(std::function<void(void)> f)
{
WiFiEventHandler handler = std::make_shared<WiFiEventHandlerOpaque>(WIFI_EVENT_STAMODE_DHCP_TIMEOUT, [f](System_Event_t* e){
(void) e;
f();
});
sCbEventList.push_back(handler);
@ -452,6 +453,7 @@ int ESP8266WiFiGenericClass::hostByName(const char* aHostname, IPAddress& aResul
* @param callback_arg
*/
void wifi_dns_found_callback(const char *name, ip_addr_t *ipaddr, void *callback_arg) {
(void) name;
if(ipaddr) {
(*reinterpret_cast<IPAddress*>(callback_arg)) = ipaddr->addr;
}

View File

@ -135,6 +135,7 @@ int WiFiClient::connect(IPAddress ip, uint16_t port)
int8_t WiFiClient::_connected(void* pcb, int8_t err)
{
(void) err;
tcp_pcb* tpcb = reinterpret_cast<tcp_pcb*>(pcb);
_client = new ClientContext(tpcb, 0, 0);
_client->ref();
@ -144,6 +145,7 @@ int8_t WiFiClient::_connected(void* pcb, int8_t err)
void WiFiClient::_err(int8_t err)
{
(void) err;
DEBUGV(":err %d\r\n", err);
esp_schedule();
}
@ -177,6 +179,7 @@ size_t WiFiClient::write(const uint8_t *buf, size_t size)
size_t WiFiClient::write(Stream& stream, size_t unused)
{
(void) unused;
return WiFiClient::write(stream);
}

View File

@ -214,6 +214,7 @@ public:
static ClientContext* getIOContext(int fd)
{
(void) fd;
return s_io_ctx;
}
@ -623,6 +624,7 @@ extern "C" void ax_port_write() __attribute__ ((weak, alias("__ax_port_write")))
extern "C" int __ax_get_file(const char *filename, uint8_t **buf)
{
(void) filename;
*buf = 0;
return 0;
}
@ -637,6 +639,8 @@ extern "C" void ax_get_file() __attribute__ ((weak, alias("__ax_get_file")));
extern "C" void* ax_port_malloc(size_t size, const char* file, int line)
{
(void) file;
(void) line;
void* result = malloc(size);
if (result == nullptr) {
DEBUG_TLS_MEM_PRINT("%s:%d malloc %d failed, left %d\r\n", file, line, size, ESP.getFreeHeap());
@ -656,6 +660,8 @@ extern "C" void* ax_port_calloc(size_t size, size_t count, const char* file, int
extern "C" void* ax_port_realloc(void* ptr, size_t size, const char* file, int line)
{
(void) file;
(void) line;
void* result = realloc(ptr, size);
if (result == nullptr) {
DEBUG_TLS_MEM_PRINT("%s:%d realloc %d failed, left %d\r\n", file, line, size, ESP.getFreeHeap());

View File

@ -97,6 +97,7 @@ bool WiFiServer::hasClient() {
}
WiFiClient WiFiServer::available(byte* status) {
(void) status;
if (_unclaimed) {
WiFiClient result(_unclaimed);
_unclaimed = _unclaimed->next();
@ -134,6 +135,8 @@ size_t WiFiServer::write(uint8_t b) {
size_t WiFiServer::write(const uint8_t *buffer, size_t size) {
// write to all clients
// not implemented
(void) buffer;
(void) size;
return 0;
}
@ -149,6 +152,7 @@ T* slist_append_tail(T* head, T* item) {
}
int8_t WiFiServer::_accept(tcp_pcb* apcb, int8_t err) {
(void) err;
DEBUGV("WS:ac\r\n");
ClientContext* client = new ClientContext(apcb, &WiFiServer::_s_discard, this);
_unclaimed = slist_append_tail(_unclaimed, client);
@ -157,6 +161,7 @@ int8_t WiFiServer::_accept(tcp_pcb* apcb, int8_t err) {
}
void WiFiServer::_discard(ClientContext* client) {
(void) client;
// _discarded = slist_append_tail(_discarded, client);
DEBUGV("WS:dis\r\n");
}

View File

@ -372,6 +372,8 @@ protected:
err_t _sent(tcp_pcb* pcb, uint16_t len)
{
(void) pcb;
(void) len;
DEBUGV(":sent %d\r\n", len);
_write_some_from_cb();
return ERR_OK;
@ -405,6 +407,8 @@ protected:
recv_ret_t _recv(tcp_pcb* pcb, pbuf* pb, err_t err)
{
(void) pcb;
(void) err;
if(pb == 0) { // connection closed
DEBUGV(":rcl\r\n");
_cancel_write();
@ -425,6 +429,7 @@ protected:
void _error(err_t err)
{
(void) err;
DEBUGV(":er %d %08x\r\n", err, (uint32_t) _datasource);
tcp_arg(_pcb, NULL);
tcp_sent(_pcb, NULL);

View File

@ -75,6 +75,7 @@ public:
void release_buffer(const uint8_t* buffer, size_t size) override
{
(void) buffer;
_pos += size;
}

View File

@ -330,6 +330,9 @@ private:
void _recv(udp_pcb *upcb, pbuf *pb,
ip_addr_t *addr, u16_t port)
{
(void) upcb;
(void) addr;
(void) port;
if (_rx_buf)
{
// there is some unread data