Skip to content

Fix warnings #2881

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jan 31, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion cores/esp8266/Esp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ EspClass ESP;

void EspClass::wdtEnable(uint32_t timeout_ms)
{
(void) timeout_ms;
/// This API can only be called if software watchdog is stopped
system_soft_wdt_restart();
}
Expand Down Expand Up @@ -432,7 +433,7 @@ uint32_t EspClass::getSketchSize() {
section_index < image_header.num_segments;
++section_index)
{
section_header_t section_header = {0};
section_header_t section_header = {0, 0};
if (spi_flash_read(pos, (uint32_t*) &section_header, sizeof(section_header))) {
return 0;
}
Expand Down
1 change: 1 addition & 0 deletions cores/esp8266/Schedule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ static int sCount = 0;

static void init_lists()
{
(void) init_lists;
if (sCount != 0) {
return;
}
Expand Down
2 changes: 2 additions & 0 deletions cores/esp8266/abi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,13 @@ void __throw_bad_alloc()

void __throw_logic_error(const char* str)
{
(void) str;
panic();
}

void __throw_out_of_range(const char* str)
{
(void) str;
panic();
}
}
Expand Down
2 changes: 1 addition & 1 deletion cores/esp8266/cont_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ void ICACHE_RAM_ATTR cont_init(cont_t* cont) {
cont->struct_start = (unsigned*) cont;

// fill stack with magic values to check high water mark
for(int pos = 0; pos < sizeof(cont->stack) / 4; pos++)
for(int pos = 0; pos < (int)(sizeof(cont->stack) / 4); pos++)
{
cont->stack[pos] = CONT_STACKGUARD;
}
Expand Down
2 changes: 2 additions & 0 deletions cores/esp8266/core_esp8266_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ const char* core_release =
} // extern "C"

int atexit(void (*func)()) {
(void) func;
return 0;
}

Expand Down Expand Up @@ -125,6 +126,7 @@ static void loop_wrapper() {
}

static void loop_task(os_event_t *events) {
(void) events;
g_micros_at_task_start = system_get_time();
cont_run(&g_cont, &loop_wrapper);
if (cont_check(&g_cont) != 0) {
Expand Down
4 changes: 4 additions & 0 deletions cores/esp8266/core_esp8266_postmortem.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ static void print_stack(uint32_t start, uint32_t end);
//static void print_pcs(uint32_t start, uint32_t end);

extern void __custom_crash_callback( struct rst_info * rst_info, uint32_t stack, uint32_t stack_end ) {
(void) rst_info;
(void) stack;
(void) stack_end;
}

extern void custom_crash_callback( struct rst_info * rst_info, uint32_t stack, uint32_t stack_end ) __attribute__ ((weak, alias("__custom_crash_callback")));
Expand Down Expand Up @@ -183,6 +186,7 @@ void abort(){
}

void __assert_func(const char *file, int line, const char *func, const char *what) {
(void) what;
s_panic_file = file;
s_panic_line = line;
s_panic_func = func;
Expand Down
2 changes: 2 additions & 0 deletions cores/esp8266/core_esp8266_timer.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
static volatile timercallback timer1_user_cb = NULL;

void ICACHE_RAM_ATTR timer1_isr_handler(void *para){
(void) para;
if ((T1C & ((1 << TCAR) | (1 << TCIT))) == 0) TEIE &= ~TEIE1;//edge int disable
T1I = 0;
if (timer1_user_cb) {
Expand Down Expand Up @@ -77,6 +78,7 @@ void ICACHE_RAM_ATTR timer1_disable(){
static volatile timercallback timer0_user_cb = NULL;

void ICACHE_RAM_ATTR timer0_isr_handler(void* para){
(void) para;
if (timer0_user_cb) {
// to make ISR compatible to Arduino AVR model where interrupts are disabled
// we disable them before we call the client ISR
Expand Down
2 changes: 2 additions & 0 deletions cores/esp8266/core_esp8266_wiring.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ static uint32_t micros_overflow_count = 0;
#define REPEAT 1

void delay_end(void* arg) {
(void) arg;
esp_schedule();
}

Expand All @@ -53,6 +54,7 @@ void delay(unsigned long ms) {
}

void micros_overflow_tick(void* arg) {
(void) arg;
uint32_t m = system_get_time();
if(m < micros_at_last_overflow_tick)
++micros_overflow_count;
Expand Down
1 change: 1 addition & 0 deletions cores/esp8266/core_esp8266_wiring_digital.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ static interrupt_handler_t interrupt_handlers[16];
static uint32_t interrupt_reg = 0;

void ICACHE_RAM_ATTR interrupt_handler(void *arg) {
(void) arg;
uint32_t status = GPIE;
GPIEC = status;//clear them interrupts
uint32_t levels = GPI;
Expand Down
14 changes: 14 additions & 0 deletions cores/esp8266/heap.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,46 +10,60 @@

void* _malloc_r(struct _reent* unused, size_t size)
{
(void) unused;
return malloc(size);
}

void _free_r(struct _reent* unused, void* ptr)
{
(void) unused;
return free(ptr);
}

void* _realloc_r(struct _reent* unused, void* ptr, size_t size)
{
(void) unused;
return realloc(ptr, size);
}

void* _calloc_r(struct _reent* unused, size_t count, size_t size)
{
(void) unused;
return calloc(count, size);
}

void* ICACHE_RAM_ATTR pvPortMalloc(size_t size, const char* file, int line)
{
(void) file;
(void) line;
return malloc(size);
}

void ICACHE_RAM_ATTR vPortFree(void *ptr, const char* file, int line)
{
(void) file;
(void) line;
free(ptr);
}

void* ICACHE_RAM_ATTR pvPortCalloc(size_t count, size_t size, const char* file, int line)
{
(void) file;
(void) line;
return calloc(count, size);
}

void* ICACHE_RAM_ATTR pvPortRealloc(void *ptr, size_t size, const char* file, int line)
{
(void) file;
(void) line;
return realloc(ptr, size);
}

void* ICACHE_RAM_ATTR pvPortZalloc(size_t size, const char* file, int line)
{
(void) file;
(void) line;
return calloc(1, size);
}

Expand Down
2 changes: 2 additions & 0 deletions cores/esp8266/libc_replacements.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ int ICACHE_RAM_ATTR _read_r(struct _reent* unused, int file, char *ptr, int len)
}

int ICACHE_RAM_ATTR _write_r(struct _reent* r, int file, char *ptr, int len) {
(void) r;
if (file == STDOUT_FILENO) {
while(len--) {
ets_putc(*ptr);
Expand All @@ -93,6 +94,7 @@ int ICACHE_RAM_ATTR _write_r(struct _reent* r, int file, char *ptr, int len) {
}

int ICACHE_RAM_ATTR _putc_r(struct _reent* r, int c, FILE* file) {
(void) r;
if (file->_file == STDOUT_FILENO) {
return ets_putc(c);
}
Expand Down
1 change: 1 addition & 0 deletions cores/esp8266/spiffs/spiffs_hydrogen.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ static s32_t spiffs_fflush_cache(spiffs *fs, spiffs_file fh);

#if SPIFFS_BUFFER_HELP
u32_t SPIFFS_buffer_bytes_for_filedescs(spiffs *fs, u32_t num_descs) {
(void) fs;
return num_descs * sizeof(spiffs_fd);
}
#if SPIFFS_CACHE
Expand Down
16 changes: 11 additions & 5 deletions cores/esp8266/spiffs_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ class SPIFFSImpl : public FSImpl
{
public:
SPIFFSImpl(uint32_t start, uint32_t size, uint32_t pageSize, uint32_t blockSize, uint32_t maxOpenFds)
: _fs({0})
, _start(start)
: _start(start)
, _size(size)
, _pageSize(pageSize)
, _blockSize(blockSize)
, _maxOpenFds(maxOpenFds)
{
memset(&_fs, 0, sizeof(_fs));
}

FileImplPtr open(const char* path, OpenMode openMode, AccessMode accessMode) override;
Expand Down Expand Up @@ -176,7 +176,8 @@ class SPIFFSImpl : public FSImpl

bool _tryMount()
{
spiffs_config config = {0};
spiffs_config config;
memset(&config, 0, sizeof(config));

config.hal_read_f = &spiffs_hal_read;
config.hal_write_f = &spiffs_hal_write;
Expand Down Expand Up @@ -242,6 +243,11 @@ class SPIFFSImpl : public FSImpl
static void _check_cb(spiffs_check_type type, spiffs_check_report report,
uint32_t arg1, uint32_t arg2)
{
(void) type;
(void) report;
(void) arg1;
(void) arg2;

// TODO: spiffs doesn't pass any context pointer along with _check_cb,
// so we can't do anything useful here other than perhaps
// feeding the watchdog
Expand All @@ -268,9 +274,9 @@ class SPIFFSFileImpl : public FileImpl
SPIFFSFileImpl(SPIFFSImpl* fs, spiffs_file fd)
: _fs(fs)
, _fd(fd)
, _stat({0})
, _written(false)
{
memset(&_stat, 0, sizeof(_stat));
_getStat();
}

Expand Down Expand Up @@ -376,7 +382,7 @@ class SPIFFSFileImpl : public FileImpl
auto rc = SPIFFS_fstat(_fs->getFs(), _fd, &_stat);
if (rc != SPIFFS_OK) {
DEBUGV("SPIFFS_fstat rc=%d\r\n", rc);
_stat = {0};
memset(&_stat, 0, sizeof(_stat));
}
_written = false;
}
Expand Down
3 changes: 3 additions & 0 deletions cores/esp8266/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ void configTime(int timezone, int daylightOffset_sec, const char* server1, const

int clock_gettime(clockid_t unused, struct timespec *tp)
{
(void) unused;
tp->tv_sec = millis() / 1000;
tp->tv_nsec = micros() * 1000;
return 0;
Expand All @@ -94,6 +95,8 @@ time_t time(time_t * t)

int _gettimeofday_r(struct _reent* unused, struct timeval *tp, void *tzp)
{
(void) unused;
(void) tzp;
if (tp)
{
ensureBootTimeIsSet();
Expand Down
1 change: 1 addition & 0 deletions cores/esp8266/uart.c
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,7 @@ bool uart_rx_enabled(uart_t* uart)

static void uart_ignore_char(char c)
{
(void) c;
}

static void uart0_write_char(char c)
Expand Down
2 changes: 1 addition & 1 deletion libraries/ESP8266WebServer/src/Parsing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ uint8_t ESP8266WebServer::_uploadReadByte(WiFiClient& client){
}

bool ESP8266WebServer::_parseForm(WiFiClient& client, String boundary, uint32_t len){

(void) len;
#ifdef DEBUG_ESP_HTTP_SERVER
DEBUG_OUTPUT.print("Parse Form: Boundary: ");
DEBUG_OUTPUT.print(boundary);
Expand Down
8 changes: 4 additions & 4 deletions libraries/ESP8266WebServer/src/detail/RequestHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
class RequestHandler {
public:
virtual ~RequestHandler() { }
virtual bool canHandle(HTTPMethod method, String uri) { return false; }
virtual bool canUpload(String uri) { return false; }
virtual bool handle(ESP8266WebServer& server, HTTPMethod requestMethod, String requestUri) { return false; }
virtual void upload(ESP8266WebServer& server, String requestUri, HTTPUpload& upload) {}
virtual bool canHandle(HTTPMethod method, String uri) { (void) method; (void) uri; return false; }
virtual bool canUpload(String uri) { (void) uri; return false; }
virtual bool handle(ESP8266WebServer& server, HTTPMethod requestMethod, String requestUri) { (void) server; (void) requestMethod; (void) requestUri; return false; }
virtual void upload(ESP8266WebServer& server, String requestUri, HTTPUpload& upload) { (void) server; (void) requestUri; (void) upload; }

RequestHandler* next() { return _next; }
void next(RequestHandler* r) { _next = r; }
Expand Down
3 changes: 3 additions & 0 deletions libraries/ESP8266WebServer/src/detail/RequestHandlersImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class FunctionRequestHandler : public RequestHandler {
}

bool handle(ESP8266WebServer& server, HTTPMethod requestMethod, String requestUri) override {
(void) server;
if (!canHandle(requestMethod, requestUri))
return false;

Expand All @@ -39,6 +40,8 @@ class FunctionRequestHandler : public RequestHandler {
}

void upload(ESP8266WebServer& server, String requestUri, HTTPUpload& upload) override {
(void) server;
(void) upload;
if (canUpload(requestUri))
_ufn();
}
Expand Down
2 changes: 2 additions & 0 deletions libraries/ESP8266WiFi/src/ESP8266WiFiGeneric.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}
Expand Down
3 changes: 3 additions & 0 deletions libraries/ESP8266WiFi/src/WiFiClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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();
}
Expand Down Expand Up @@ -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);
}

Expand Down
Loading