Address STM32 cppcheck warnings (#11314)

- Suppress GenericThreadModule warning when DEBUG_MUTE
- Suppress warning stemming from check_skip_packages
- Cast pointers to uint32_t before subtracting to avoid cppcheck warning
This commit is contained in:
Austin
2026-08-01 00:28:01 +00:00
committed by GitHub
parent 5bfad255e0
commit 85c1bd4836
3 files changed
+10 -1

No files matched your search

+4 -1
View File
@@ -23,7 +23,10 @@ static uint32_t sbrkHeadroom()
extern char _estack;
extern char _Min_Stack_Size;
uint32_t max_sp = (uint32_t)(&_estack - &_Min_Stack_Size);
// Both are linker-script symbols rather than real objects: _estack is the top-of-RAM address and
// _Min_Stack_Size is a plain value. Convert each to an integer before subtracting - differencing the
// pointers themselves is pointer arithmetic across unrelated objects.
uint32_t max_sp = (uint32_t)&_estack - (uint32_t)&_Min_Stack_Size;
uint32_t heap_end = (uint32_t)sbrk(0);
return (max_sp > heap_end) ? (max_sp - heap_end) : 0;
}