tree-wide: suppress misc-use-internal-linkage warnings

Suppress warnings like the following from clang tidy:
```
../src/boot/addon.c:11:19: error: function 'efi_main' can be made static to enforce internal linkage [misc-use-internal-linkage,-warnings-as-errors]
   11 | EFIAPI EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *system_table);
      |                   ^
```

Some warnings are suppressed simply by setting comments to ignore the warning,
some are by making global variables static, or include a suitable header.
This commit is contained in:
Yu Watanabe
2026-03-05 20:23:24 +01:00
committed by Zbigniew Jędrzejewski-Szmek
parent e65a6e26ad
commit 8903e6b5f7
14 changed files with 27 additions and 6 deletions
+1
View File
@@ -8,6 +8,7 @@ DECLARE_NOALLOC_SECTION(".sdmagic", "#### LoaderInfo: systemd-addon " GIT_VERSIO
/* This is intended to carry data, not to be executed */
// NOLINTNEXTLINE(misc-use-internal-linkage)
EFIAPI EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *system_table);
EFIAPI EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *system_table) {
return EFI_UNSUPPORTED;
+1
View File
@@ -3255,4 +3255,5 @@ static EFI_STATUS run(EFI_HANDLE image) {
}
}
// NOLINTNEXTLINE(misc-use-internal-linkage)
DEFINE_EFI_MAIN_FUNCTION(run, "systemd-boot", /* wait_for_debugger= */ false);
+6
View File
@@ -132,6 +132,7 @@ void log_wait(void) {
log_count = 0;
}
// NOLINTNEXTLINE(misc-use-internal-linkage)
_used_ intptr_t __stack_chk_guard = (intptr_t) 0x70f6967de78acae3;
/* We can only set a random stack canary if this function attribute is available,
@@ -147,8 +148,10 @@ void __stack_chk_guard_init(void) {
}
#endif
// NOLINTBEGIN(misc-use-internal-linkage)
_used_ _noreturn_ void __stack_chk_fail(void);
_used_ _noreturn_ void __stack_chk_fail_local(void);
// NOLINTEND(misc-use-internal-linkage)
void __stack_chk_fail(void) {
panic(u"systemd-boot: Stack check failed, halting.");
}
@@ -157,6 +160,7 @@ void __stack_chk_fail_local(void) {
}
/* Called by libgcc for some fatal errors like integer overflow with -ftrapv. */
// NOLINTNEXTLINE(misc-use-internal-linkage)
_used_ _noreturn_ void abort(void);
void abort(void) {
panic(u"systemd-boot: Unknown error, halting.");
@@ -164,8 +168,10 @@ void abort(void) {
#if defined(__ARM_EABI__)
/* These override the (weak) div0 handlers from libgcc as they would otherwise call raise() instead. */
// NOLINTBEGIN(misc-use-internal-linkage)
_used_ _noreturn_ int __aeabi_idiv0(int return_value);
_used_ _noreturn_ long long __aeabi_ldiv0(long long return_value);
// NOLINTEND(misc-use-internal-linkage)
int __aeabi_idiv0(int return_value) {
panic(u"systemd-boot: Division by zero, halting.");
+2
View File
@@ -1050,10 +1050,12 @@ char16_t *xvasprintf_status(EFI_STATUS status, const char *format, va_list ap) {
# undef memcmp
# undef memcpy
# undef memset
// NOLINTBEGIN(misc-use-internal-linkage)
_used_ void *memchr(const void *p, int c, size_t n);
_used_ int memcmp(const void *p1, const void *p2, size_t n);
_used_ void *memcpy(void * restrict dest, const void * restrict src, size_t n);
_used_ void *memset(void *p, int c, size_t n);
// NOLINTEND(misc-use-internal-linkage)
#else
/* And for userspace unit testing we need to give them an efi_ prefix. */
# undef memchr
+3
View File
@@ -20,6 +20,7 @@ print(
#include <stddef.h>
#include <stdint.h>
// NOLINTNEXTLINE(misc-use-internal-linkage)
const uint8_t hwids_section_data[] = {
""",
end='',
@@ -34,6 +35,8 @@ for i, b in enumerate(hwids):
print(
"""};
// NOLINTNEXTLINE(misc-use-internal-linkage)
const size_t hwids_section_len =""",
f'{len(hwids)};',
)
+1
View File
@@ -1325,4 +1325,5 @@ static EFI_STATUS run(EFI_HANDLE image) {
return err;
}
// NOLINTNEXTLINE(misc-use-internal-linkage)
DEFINE_EFI_MAIN_FUNCTION(run, "systemd-stub", /* wait_for_debugger= */ false);