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:
committed by
Ivan Grokhotkov
parent
d85e783806
commit
2126146e20
@ -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();
|
||||
}
|
||||
@ -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*) §ion_header, sizeof(section_header))) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ static int sCount = 0;
|
||||
|
||||
static void init_lists()
|
||||
{
|
||||
(void) init_lists;
|
||||
if (sCount != 0) {
|
||||
return;
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -52,6 +52,7 @@ const char* core_release =
|
||||
} // extern "C"
|
||||
|
||||
int atexit(void (*func)()) {
|
||||
(void) func;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -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) {
|
||||
|
@ -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")));
|
||||
@ -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;
|
||||
|
@ -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) {
|
||||
@ -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
|
||||
|
@ -36,6 +36,7 @@ static uint32_t micros_overflow_count = 0;
|
||||
#define REPEAT 1
|
||||
|
||||
void delay_end(void* arg) {
|
||||
(void) arg;
|
||||
esp_schedule();
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
@ -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);
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
@ -176,7 +176,8 @@ protected:
|
||||
|
||||
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;
|
||||
@ -242,6 +243,11 @@ protected:
|
||||
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
|
||||
@ -268,9 +274,9 @@ public:
|
||||
SPIFFSFileImpl(SPIFFSImpl* fs, spiffs_file fd)
|
||||
: _fs(fs)
|
||||
, _fd(fd)
|
||||
, _stat({0})
|
||||
, _written(false)
|
||||
{
|
||||
memset(&_stat, 0, sizeof(_stat));
|
||||
_getStat();
|
||||
}
|
||||
|
||||
@ -376,7 +382,7 @@ protected:
|
||||
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;
|
||||
}
|
||||
|
@ -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;
|
||||
@ -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();
|
||||
|
@ -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)
|
||||
|
Reference in New Issue
Block a user