Skip to content

Commit 2126146

Browse files
rodionkvashninigrr
authored andcommitted
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.
1 parent d85e783 commit 2126146

27 files changed

+92
-12
lines changed

cores/esp8266/Esp.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ EspClass ESP;
8383

8484
void EspClass::wdtEnable(uint32_t timeout_ms)
8585
{
86+
(void) timeout_ms;
8687
/// This API can only be called if software watchdog is stopped
8788
system_soft_wdt_restart();
8889
}
@@ -432,7 +433,7 @@ uint32_t EspClass::getSketchSize() {
432433
section_index < image_header.num_segments;
433434
++section_index)
434435
{
435-
section_header_t section_header = {0};
436+
section_header_t section_header = {0, 0};
436437
if (spi_flash_read(pos, (uint32_t*) &section_header, sizeof(section_header))) {
437438
return 0;
438439
}

cores/esp8266/Schedule.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ static int sCount = 0;
1616

1717
static void init_lists()
1818
{
19+
(void) init_lists;
1920
if (sCount != 0) {
2021
return;
2122
}

cores/esp8266/abi.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,13 @@ void __throw_bad_alloc()
104104

105105
void __throw_logic_error(const char* str)
106106
{
107+
(void) str;
107108
panic();
108109
}
109110

110111
void __throw_out_of_range(const char* str)
111112
{
113+
(void) str;
112114
panic();
113115
}
114116
}

cores/esp8266/cont_util.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ void ICACHE_RAM_ATTR cont_init(cont_t* cont) {
3232
cont->struct_start = (unsigned*) cont;
3333

3434
// fill stack with magic values to check high water mark
35-
for(int pos = 0; pos < sizeof(cont->stack) / 4; pos++)
35+
for(int pos = 0; pos < (int)(sizeof(cont->stack) / 4); pos++)
3636
{
3737
cont->stack[pos] = CONT_STACKGUARD;
3838
}

cores/esp8266/core_esp8266_main.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ const char* core_release =
5252
} // extern "C"
5353

5454
int atexit(void (*func)()) {
55+
(void) func;
5556
return 0;
5657
}
5758

@@ -125,6 +126,7 @@ static void loop_wrapper() {
125126
}
126127

127128
static void loop_task(os_event_t *events) {
129+
(void) events;
128130
g_micros_at_task_start = system_get_time();
129131
cont_run(&g_cont, &loop_wrapper);
130132
if (cont_check(&g_cont) != 0) {

cores/esp8266/core_esp8266_postmortem.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ static void print_stack(uint32_t start, uint32_t end);
4646
//static void print_pcs(uint32_t start, uint32_t end);
4747

4848
extern void __custom_crash_callback( struct rst_info * rst_info, uint32_t stack, uint32_t stack_end ) {
49+
(void) rst_info;
50+
(void) stack;
51+
(void) stack_end;
4952
}
5053

5154
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(){
183186
}
184187

185188
void __assert_func(const char *file, int line, const char *func, const char *what) {
189+
(void) what;
186190
s_panic_file = file;
187191
s_panic_line = line;
188192
s_panic_func = func;

cores/esp8266/core_esp8266_timer.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
static volatile timercallback timer1_user_cb = NULL;
3131

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

7980
void ICACHE_RAM_ATTR timer0_isr_handler(void* para){
81+
(void) para;
8082
if (timer0_user_cb) {
8183
// to make ISR compatible to Arduino AVR model where interrupts are disabled
8284
// we disable them before we call the client ISR

cores/esp8266/core_esp8266_wiring.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ static uint32_t micros_overflow_count = 0;
3636
#define REPEAT 1
3737

3838
void delay_end(void* arg) {
39+
(void) arg;
3940
esp_schedule();
4041
}
4142

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

5556
void micros_overflow_tick(void* arg) {
57+
(void) arg;
5658
uint32_t m = system_get_time();
5759
if(m < micros_at_last_overflow_tick)
5860
++micros_overflow_count;

cores/esp8266/core_esp8266_wiring_digital.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ static interrupt_handler_t interrupt_handlers[16];
115115
static uint32_t interrupt_reg = 0;
116116

117117
void ICACHE_RAM_ATTR interrupt_handler(void *arg) {
118+
(void) arg;
118119
uint32_t status = GPIE;
119120
GPIEC = status;//clear them interrupts
120121
uint32_t levels = GPI;

cores/esp8266/heap.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,46 +10,60 @@
1010

1111
void* _malloc_r(struct _reent* unused, size_t size)
1212
{
13+
(void) unused;
1314
return malloc(size);
1415
}
1516

1617
void _free_r(struct _reent* unused, void* ptr)
1718
{
19+
(void) unused;
1820
return free(ptr);
1921
}
2022

2123
void* _realloc_r(struct _reent* unused, void* ptr, size_t size)
2224
{
25+
(void) unused;
2326
return realloc(ptr, size);
2427
}
2528

2629
void* _calloc_r(struct _reent* unused, size_t count, size_t size)
2730
{
31+
(void) unused;
2832
return calloc(count, size);
2933
}
3034

3135
void* ICACHE_RAM_ATTR pvPortMalloc(size_t size, const char* file, int line)
3236
{
37+
(void) file;
38+
(void) line;
3339
return malloc(size);
3440
}
3541

3642
void ICACHE_RAM_ATTR vPortFree(void *ptr, const char* file, int line)
3743
{
44+
(void) file;
45+
(void) line;
3846
free(ptr);
3947
}
4048

4149
void* ICACHE_RAM_ATTR pvPortCalloc(size_t count, size_t size, const char* file, int line)
4250
{
51+
(void) file;
52+
(void) line;
4353
return calloc(count, size);
4454
}
4555

4656
void* ICACHE_RAM_ATTR pvPortRealloc(void *ptr, size_t size, const char* file, int line)
4757
{
58+
(void) file;
59+
(void) line;
4860
return realloc(ptr, size);
4961
}
5062

5163
void* ICACHE_RAM_ATTR pvPortZalloc(size_t size, const char* file, int line)
5264
{
65+
(void) file;
66+
(void) line;
5367
return calloc(1, size);
5468
}
5569

0 commit comments

Comments
 (0)