Skip to content

Commit 9f99339

Browse files
authored
Various fixes to streamline running code analysis tools such as clang-tidy (#37224)
2 parents d1461e5 + e5dd1fd commit 9f99339

File tree

3 files changed

+17
-12
lines changed

3 files changed

+17
-12
lines changed

meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ endforeach
9292
efi_conf.set_quoted('PROJECT_VERSION', project_major_version)
9393
efi_conf.set_quoted('VERSION_TAG', version_tag)
9494
efi_conf.set('PROJECT_URL', conf.get('PROJECT_URL'))
95+
efi_conf.set_quoted('RELATIVE_SOURCE_PATH', relative_source_path)
9596

9697
if meson.is_cross_build() and get_option('sbat-distro') == 'auto'
9798
warning('Auto detection of SBAT information not supported when cross-building, disabling SBAT.')

util.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,19 @@
1313
/* Never try to read more than 16G into memory (and on 32bit 1G) */
1414
#define FILE_READ_MAX MIN(SIZE_MAX/4, UINT64_C(16)*1024U*1024U*1024U)
1515

16+
void free(void *p) {
17+
if (!p)
18+
return;
19+
20+
/* Debugging an invalid free requires trace logging to find the call site or a debugger attached. For
21+
* release builds it is not worth the bother to even warn when we cannot even print a call stack. */
22+
#ifdef EFI_DEBUG
23+
assert_se(BS->FreePool(p) == EFI_SUCCESS);
24+
#else
25+
(void) BS->FreePool(p);
26+
#endif
27+
}
28+
1629
void convert_efi_path(char16_t *path) {
1730
assert(path);
1831

util.h

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,9 @@
1414
/* This is provided by the linker. */
1515
extern uint8_t __executable_start[];
1616

17-
static inline void free(void *p) {
18-
if (!p)
19-
return;
20-
21-
/* Debugging an invalid free requires trace logging to find the call site or a debugger attached. For
22-
* release builds it is not worth the bother to even warn when we cannot even print a call stack. */
23-
#ifdef EFI_DEBUG
24-
assert_se(BS->FreePool(p) == EFI_SUCCESS);
25-
#else
26-
(void) BS->FreePool(p);
27-
#endif
28-
}
17+
DISABLE_WARNING_REDUNDANT_DECLS;
18+
void free(void *p);
19+
REENABLE_WARNING;
2920

3021
static inline void freep(void *p) {
3122
free(*(void **) p);

0 commit comments

Comments
 (0)