cpu/esp: Suppress cppcheck errors

cpu/esp_common/syscalls.c💯 error (memleak): Memory leak: mtx
cpu/esp_common/syscalls.c:131: error (memleak): Memory leak: rmtx
cpu/esp_common/syscalls.c:365: error (comparePointers): Subtracting pointers that point to different objects

cpu/esp_common/thread_arch.c:355: error (comparePointers): Comparing pointers that point to different objects

cpu/esp8266/startup.c:59: error (comparePointers): Subtracting pointers that point to different objects
This commit is contained in:
Erik Ekman 2021-11-25 10:47:33 +01:00
parent c0004920ec
commit e5d60176e4
3 changed files with 6 additions and 1 deletions

View File

@ -56,6 +56,7 @@ void esp_riot_init(void)
extern uint8_t _rtc_bss_start, _rtc_bss_end; extern uint8_t _rtc_bss_start, _rtc_bss_end;
esp_reset_reason_t reset_reason = esp_reset_reason(); esp_reset_reason_t reset_reason = esp_reset_reason();
if (reset_reason != ESP_RST_DEEPSLEEP && reset_reason != ESP_RST_SW) { if (reset_reason != ESP_RST_DEEPSLEEP && reset_reason != ESP_RST_SW) {
/* cppcheck-suppress comparePointers */
memset(&_rtc_bss_start, 0, (&_rtc_bss_end - &_rtc_bss_start)); memset(&_rtc_bss_start, 0, (&_rtc_bss_end - &_rtc_bss_start));
} }

View File

@ -97,6 +97,7 @@ void IRAM_ATTR _lock_init(_lock_t *lock)
memset(mtx, 0, sizeof(mutex_t)); memset(mtx, 0, sizeof(mutex_t));
*lock = (_lock_t)mtx; *lock = (_lock_t)mtx;
} }
/* cppcheck-suppress memleak; mtx is stored in lock */
} }
void IRAM_ATTR _lock_init_recursive(_lock_t *lock) void IRAM_ATTR _lock_init_recursive(_lock_t *lock)
@ -128,6 +129,7 @@ void IRAM_ATTR _lock_init_recursive(_lock_t *lock)
memset(rmtx, 0, sizeof(rmutex_t)); memset(rmtx, 0, sizeof(rmutex_t));
*lock = (_lock_t)rmtx; *lock = (_lock_t)rmtx;
} }
/* cppcheck-suppress memleak; rmtx is stored in lock */
} }
void IRAM_ATTR _lock_close(_lock_t *lock) void IRAM_ATTR _lock_close(_lock_t *lock)
@ -257,7 +259,7 @@ void IRAM_ATTR _lock_release_recursive(_lock_t *lock)
#ifdef MODULE_ESP_IDF_HEAP #ifdef MODULE_ESP_IDF_HEAP
#define heap_caps_malloc_default(s) heap_caps_malloc(s, MALLOC_CAP_DEFAULT) #define heap_caps_malloc_default(s) heap_caps_malloc(s, MALLOC_CAP_DEFAULT)
#define heap_caps_realloc_default(p,s) heap_caps_realloc(p, s, MALLOC_CAP_DEFAULT) #define heap_caps_realloc_default(p, s) heap_caps_realloc(p, s, MALLOC_CAP_DEFAULT)
void* IRAM_ATTR __wrap__malloc_r(struct _reent *r, size_t size) void* IRAM_ATTR __wrap__malloc_r(struct _reent *r, size_t size)
{ {
@ -362,6 +364,7 @@ extern uint8_t _eheap3;
unsigned int IRAM_ATTR get_free_heap_size(void) unsigned int IRAM_ATTR get_free_heap_size(void)
{ {
struct mallinfo minfo = mallinfo(); struct mallinfo minfo = mallinfo();
/* cppcheck-suppress comparePointers */
unsigned int heap_size = &_eheap - &_sheap; unsigned int heap_size = &_eheap - &_sheap;
#if NUM_HEAPS > 1 #if NUM_HEAPS > 1
heap_size += &_eheap1 - &_sheap1; heap_size += &_eheap1 - &_sheap1;

View File

@ -352,6 +352,7 @@ void thread_isr_stack_init(void)
uintptr_t *stackmax = (uintptr_t *)(uintptr_t)sp; uintptr_t *stackmax = (uintptr_t *)(uintptr_t)sp;
uintptr_t *stackp = (uintptr_t *)(uintptr_t)&port_IntStack; uintptr_t *stackp = (uintptr_t *)(uintptr_t)&port_IntStack;
/* cppcheck-suppress comparePointers */
while (stackp < stackmax) { while (stackp < stackmax) {
*stackp = (uintptr_t) stackp; *stackp = (uintptr_t) stackp;
stackp++; stackp++;