boot: Make free() a non inline function

The static inline declaration in iovec-fundamental.h causes static
analyze tooling warnings (clang-tidy). Let's get around it by making
free() non-inline. LTO will make sure it's still inlined properly.
This commit is contained in:
Daan De Meyer
2025-04-23 11:50:32 +02:00
parent c0ced8fc32
commit ed2506d1d0
3 changed files with 17 additions and 13 deletions
+13
View File
@@ -13,6 +13,19 @@
/* Never try to read more than 16G into memory (and on 32bit 1G) */
#define FILE_READ_MAX MIN(SIZE_MAX/4, UINT64_C(16)*1024U*1024U*1024U)
void free(void *p) {
if (!p)
return;
/* Debugging an invalid free requires trace logging to find the call site or a debugger attached. For
* release builds it is not worth the bother to even warn when we cannot even print a call stack. */
#ifdef EFI_DEBUG
assert_se(BS->FreePool(p) == EFI_SUCCESS);
#else
(void) BS->FreePool(p);
#endif
}
void convert_efi_path(char16_t *path) {
assert(path);
+3 -12
View File
@@ -14,18 +14,9 @@
/* This is provided by the linker. */
extern uint8_t __executable_start[];
static inline void free(void *p) {
if (!p)
return;
/* Debugging an invalid free requires trace logging to find the call site or a debugger attached. For
* release builds it is not worth the bother to even warn when we cannot even print a call stack. */
#ifdef EFI_DEBUG
assert_se(BS->FreePool(p) == EFI_SUCCESS);
#else
(void) BS->FreePool(p);
#endif
}
DISABLE_WARNING_REDUNDANT_DECLS;
void free(void *p);
REENABLE_WARNING;
static inline void freep(void *p) {
free(*(void **) p);
+1 -1
View File
@@ -17,7 +17,7 @@ struct iovec {
};
DISABLE_WARNING_REDUNDANT_DECLS;
static inline void free(void *p);
void free(void *p);
REENABLE_WARNING;
#endif