From a984eb367c032dbe2577f01238c3d1268526be70 Mon Sep 17 00:00:00 2001 From: Kacper Date: Thu, 25 Dec 2025 19:24:38 +0100 Subject: Clang-tidy fixes --- lib/libc/internal/arch/x86_64/longjmp.c | 3 +- lib/libc/internal/deinit/tls.c | 2 + lib/libc/internal/include/__signal.h | 12 +++--- lib/libc/internal/include/__thread.h | 1 - lib/libc/internal/include/atomic.h | 1 - lib/libc/internal/include/io_uring.h | 4 +- lib/libc/internal/include/malloc.h | 73 ++++++++++++--------------------- lib/libc/internal/init/init.c | 1 + lib/libc/internal/init/io.c | 4 +- lib/libc/internal/init/tls.c | 3 +- lib/libc/internal/init/vdso.c | 2 + 11 files changed, 45 insertions(+), 61 deletions(-) (limited to 'lib/libc/internal') diff --git a/lib/libc/internal/arch/x86_64/longjmp.c b/lib/libc/internal/arch/x86_64/longjmp.c index dbd18632..672b2177 100644 --- a/lib/libc/internal/arch/x86_64/longjmp.c +++ b/lib/libc/internal/arch/x86_64/longjmp.c @@ -2,8 +2,7 @@ #include // for longjmp -__attribute__((noreturn, naked, returns_twice)) void longjmp(jmp_buf env, - int val) +__attribute__((noreturn, naked, returns_twice)) void longjmp(jmp_buf env, int val) { __asm__ __volatile__("mov 0(%rdi), %rbx\n" "mov 8(%rdi), %rbp\n" diff --git a/lib/libc/internal/deinit/tls.c b/lib/libc/internal/deinit/tls.c index 0eb78aeb..9e0af1b4 100644 --- a/lib/libc/internal/deinit/tls.c +++ b/lib/libc/internal/deinit/tls.c @@ -1,3 +1,5 @@ +#include "stddef.h" +#include "sys/cdefs.h" #include #include diff --git a/lib/libc/internal/include/__signal.h b/lib/libc/internal/include/__signal.h index 6b762dee..f5d32e3c 100644 --- a/lib/libc/internal/include/__signal.h +++ b/lib/libc/internal/include/__signal.h @@ -1,12 +1,10 @@ #ifndef __LIBC_SIGNAL_H #define __LIBC_SIGNAL_H -static const char *__sys_signame[] = { - "SIGHUP", "SIGINT", "SIGQUIT", "SIGILL", "SIGTRAP", "SIGABRT", - "SIGBUS", "SIGFPE", "SIGKILL", "SIGUSR1", "SIGSEGV", "SIGUSR2", - "SIGPIPE", "SIGALRM", "SIGTERM", "SIGCHLD", "SIGCONT", "SIGSTOP", - "SIGTSTP", "SIGTTIN", "SIGTTOU", "SIGURG", "SIGXCPU", "SIGXFSZ", - "SIGVTALRM", "SIGPROF", "SIGWINCH", "SIGIO", "SIGSYS" -}; +static const char *__sys_signame[] = { "SIGHUP", "SIGINT", "SIGQUIT", "SIGILL", "SIGTRAP", "SIGABRT", + "SIGBUS", "SIGFPE", "SIGKILL", "SIGUSR1", "SIGSEGV", "SIGUSR2", + "SIGPIPE", "SIGALRM", "SIGTERM", "SIGCHLD", "SIGCONT", "SIGSTOP", + "SIGTSTP", "SIGTTIN", "SIGTTOU", "SIGURG", "SIGXCPU", "SIGXFSZ", + "SIGVTALRM", "SIGPROF", "SIGWINCH", "SIGIO", "SIGSYS" }; #endif diff --git a/lib/libc/internal/include/__thread.h b/lib/libc/internal/include/__thread.h index 3c68f8dd..1bdd42c2 100644 --- a/lib/libc/internal/include/__thread.h +++ b/lib/libc/internal/include/__thread.h @@ -1,7 +1,6 @@ #ifndef __LIBC_THREAD_H #define __LIBC_THREAD_H -#include #include #include diff --git a/lib/libc/internal/include/atomic.h b/lib/libc/internal/include/atomic.h index d40c1eae..c935535c 100644 --- a/lib/libc/internal/include/atomic.h +++ b/lib/libc/internal/include/atomic.h @@ -4,7 +4,6 @@ #include #include #include -#include #define LIBC_LOCK(__lock) __libc_lock(&((__lock))) #define LIBC_UNLOCK(__lock) __libc_unlock(&((__lock))) diff --git a/lib/libc/internal/include/io_uring.h b/lib/libc/internal/include/io_uring.h index 4dac4583..cd53941d 100644 --- a/lib/libc/internal/include/io_uring.h +++ b/lib/libc/internal/include/io_uring.h @@ -3,6 +3,7 @@ #include #include +#include #define IO_URING_ENTRIES 256 @@ -47,7 +48,6 @@ int io_uring_setup(unsigned int, struct io_uring_params *); int io_uring_register(unsigned int, unsigned int, void *, unsigned int); -int io_uring_enter(unsigned int, unsigned int, unsigned int, unsigned int, - sigset_t *, size_t); +int io_uring_enter(unsigned int, unsigned int, unsigned int, unsigned int, sigset_t *, size_t); #endif diff --git a/lib/libc/internal/include/malloc.h b/lib/libc/internal/include/malloc.h index b7cb0093..98361ebd 100644 --- a/lib/libc/internal/include/malloc.h +++ b/lib/libc/internal/include/malloc.h @@ -45,54 +45,35 @@ extern struct page *__malloc_pvec; #define LARGE_PAGE_SIZE (1 << LARGE_PAGE_SIZE_SHIFT) #define LARGE_PAGE_MASK (~((uintptr_t)LARGE_PAGE_SIZE - 1)) -#define SMALL_CLASS(n) \ - { (((n)) * 16), (SMALL_PAGE_SIZE - sizeof(struct page)) / (((n)) * 16) } -#define MEDIUM_CLASS(n) \ - { (((n)) * 16), \ - (MEDIUM_PAGE_SIZE - sizeof(struct page)) / (((n)) * 16) } -#define LARGE_CLASS(n) \ - { (((n)) * 16), (LARGE_PAGE_SIZE - sizeof(struct page)) / (((n)) * 16) } +#define SMALL_CLASS(n) { (((n)) * 16), (SMALL_PAGE_SIZE - sizeof(struct page)) / (((n)) * 16) } +#define MEDIUM_CLASS(n) { (((n)) * 16), (MEDIUM_PAGE_SIZE - sizeof(struct page)) / (((n)) * 16) } +#define LARGE_CLASS(n) { (((n)) * 16), (LARGE_PAGE_SIZE - sizeof(struct page)) / (((n)) * 16) } static const struct class global_size_class[] = { - SMALL_CLASS(1), SMALL_CLASS(1), SMALL_CLASS(2), - SMALL_CLASS(3), SMALL_CLASS(4), SMALL_CLASS(5), - SMALL_CLASS(6), SMALL_CLASS(7), SMALL_CLASS(8), - SMALL_CLASS(9), SMALL_CLASS(10), SMALL_CLASS(11), - SMALL_CLASS(12), SMALL_CLASS(13), SMALL_CLASS(14), - SMALL_CLASS(15), SMALL_CLASS(16), SMALL_CLASS(17), - SMALL_CLASS(18), SMALL_CLASS(19), SMALL_CLASS(20), - SMALL_CLASS(21), SMALL_CLASS(22), SMALL_CLASS(23), - SMALL_CLASS(24), SMALL_CLASS(25), SMALL_CLASS(26), - SMALL_CLASS(27), SMALL_CLASS(28), SMALL_CLASS(29), - SMALL_CLASS(30), SMALL_CLASS(31), SMALL_CLASS(32), - SMALL_CLASS(33), SMALL_CLASS(34), SMALL_CLASS(35), - SMALL_CLASS(36), SMALL_CLASS(37), SMALL_CLASS(38), - SMALL_CLASS(39), SMALL_CLASS(40), SMALL_CLASS(41), - SMALL_CLASS(42), SMALL_CLASS(43), SMALL_CLASS(44), - SMALL_CLASS(45), SMALL_CLASS(46), SMALL_CLASS(47), - SMALL_CLASS(48), SMALL_CLASS(49), SMALL_CLASS(50), - SMALL_CLASS(51), SMALL_CLASS(52), SMALL_CLASS(53), - SMALL_CLASS(54), SMALL_CLASS(55), SMALL_CLASS(56), - SMALL_CLASS(57), SMALL_CLASS(58), SMALL_CLASS(59), - SMALL_CLASS(60), SMALL_CLASS(61), SMALL_CLASS(62), - SMALL_CLASS(63), SMALL_CLASS(64), SMALL_CLASS(80), - SMALL_CLASS(96), SMALL_CLASS(112), SMALL_CLASS(128), - SMALL_CLASS(160), SMALL_CLASS(192), SMALL_CLASS(224), - SMALL_CLASS(256), MEDIUM_CLASS(320), MEDIUM_CLASS(384), - MEDIUM_CLASS(448), MEDIUM_CLASS(512), MEDIUM_CLASS(640), - MEDIUM_CLASS(768), MEDIUM_CLASS(896), MEDIUM_CLASS(1024), - MEDIUM_CLASS(1280), MEDIUM_CLASS(1536), MEDIUM_CLASS(1792), - MEDIUM_CLASS(2048), MEDIUM_CLASS(2560), MEDIUM_CLASS(3072), - MEDIUM_CLASS(3584), MEDIUM_CLASS(4096), MEDIUM_CLASS(5120), - MEDIUM_CLASS(6144), MEDIUM_CLASS(7168), MEDIUM_CLASS(8192), - MEDIUM_CLASS(10240), MEDIUM_CLASS(12288), MEDIUM_CLASS(14336), - MEDIUM_CLASS(16384), LARGE_CLASS(20480), LARGE_CLASS(24576), - LARGE_CLASS(28672), LARGE_CLASS(32768), LARGE_CLASS(40960), - LARGE_CLASS(49152), LARGE_CLASS(57344), LARGE_CLASS(65536), - LARGE_CLASS(81920), LARGE_CLASS(98304), LARGE_CLASS(114688), - LARGE_CLASS(131072), LARGE_CLASS(163840), LARGE_CLASS(196608), - LARGE_CLASS(229376), LARGE_CLASS(262144), LARGE_CLASS(327680), - LARGE_CLASS(393216), LARGE_CLASS(458752), LARGE_CLASS(524288) + SMALL_CLASS(1), SMALL_CLASS(1), SMALL_CLASS(2), SMALL_CLASS(3), SMALL_CLASS(4), + SMALL_CLASS(5), SMALL_CLASS(6), SMALL_CLASS(7), SMALL_CLASS(8), SMALL_CLASS(9), + SMALL_CLASS(10), SMALL_CLASS(11), SMALL_CLASS(12), SMALL_CLASS(13), SMALL_CLASS(14), + SMALL_CLASS(15), SMALL_CLASS(16), SMALL_CLASS(17), SMALL_CLASS(18), SMALL_CLASS(19), + SMALL_CLASS(20), SMALL_CLASS(21), SMALL_CLASS(22), SMALL_CLASS(23), SMALL_CLASS(24), + SMALL_CLASS(25), SMALL_CLASS(26), SMALL_CLASS(27), SMALL_CLASS(28), SMALL_CLASS(29), + SMALL_CLASS(30), SMALL_CLASS(31), SMALL_CLASS(32), SMALL_CLASS(33), SMALL_CLASS(34), + SMALL_CLASS(35), SMALL_CLASS(36), SMALL_CLASS(37), SMALL_CLASS(38), SMALL_CLASS(39), + SMALL_CLASS(40), SMALL_CLASS(41), SMALL_CLASS(42), SMALL_CLASS(43), SMALL_CLASS(44), + SMALL_CLASS(45), SMALL_CLASS(46), SMALL_CLASS(47), SMALL_CLASS(48), SMALL_CLASS(49), + SMALL_CLASS(50), SMALL_CLASS(51), SMALL_CLASS(52), SMALL_CLASS(53), SMALL_CLASS(54), + SMALL_CLASS(55), SMALL_CLASS(56), SMALL_CLASS(57), SMALL_CLASS(58), SMALL_CLASS(59), + SMALL_CLASS(60), SMALL_CLASS(61), SMALL_CLASS(62), SMALL_CLASS(63), SMALL_CLASS(64), + SMALL_CLASS(80), SMALL_CLASS(96), SMALL_CLASS(112), SMALL_CLASS(128), SMALL_CLASS(160), + SMALL_CLASS(192), SMALL_CLASS(224), SMALL_CLASS(256), MEDIUM_CLASS(320), MEDIUM_CLASS(384), + MEDIUM_CLASS(448), MEDIUM_CLASS(512), MEDIUM_CLASS(640), MEDIUM_CLASS(768), MEDIUM_CLASS(896), + MEDIUM_CLASS(1024), MEDIUM_CLASS(1280), MEDIUM_CLASS(1536), MEDIUM_CLASS(1792), MEDIUM_CLASS(2048), + MEDIUM_CLASS(2560), MEDIUM_CLASS(3072), MEDIUM_CLASS(3584), MEDIUM_CLASS(4096), MEDIUM_CLASS(5120), + MEDIUM_CLASS(6144), MEDIUM_CLASS(7168), MEDIUM_CLASS(8192), MEDIUM_CLASS(10240), MEDIUM_CLASS(12288), + MEDIUM_CLASS(14336), MEDIUM_CLASS(16384), LARGE_CLASS(20480), LARGE_CLASS(24576), LARGE_CLASS(28672), + LARGE_CLASS(32768), LARGE_CLASS(40960), LARGE_CLASS(49152), LARGE_CLASS(57344), LARGE_CLASS(65536), + LARGE_CLASS(81920), LARGE_CLASS(98304), LARGE_CLASS(114688), LARGE_CLASS(131072), LARGE_CLASS(163840), + LARGE_CLASS(196608), LARGE_CLASS(229376), LARGE_CLASS(262144), LARGE_CLASS(327680), LARGE_CLASS(393216), + LARGE_CLASS(458752), LARGE_CLASS(524288) }; #endif diff --git a/lib/libc/internal/init/init.c b/lib/libc/internal/init/init.c index 62678dce..85d4d8f0 100644 --- a/lib/libc/internal/init/init.c +++ b/lib/libc/internal/init/init.c @@ -2,6 +2,7 @@ #include #include #include +#include #include #include diff --git a/lib/libc/internal/init/io.c b/lib/libc/internal/init/io.c index 4790af89..2bf58a9a 100644 --- a/lib/libc/internal/init/io.c +++ b/lib/libc/internal/init/io.c @@ -1,7 +1,9 @@ -#include +#include "__stdio.h" +#include "stddef.h" #include #include #include +#include #include struct __FILE *const stdout = (struct __FILE *)&__libc.stdout; diff --git a/lib/libc/internal/init/tls.c b/lib/libc/internal/init/tls.c index 302edd9d..e23efc0d 100644 --- a/lib/libc/internal/init/tls.c +++ b/lib/libc/internal/init/tls.c @@ -1,7 +1,8 @@ +#include "stddef.h" #include <__thread.h> -#include #include #include +#include #include #include #include diff --git a/lib/libc/internal/init/vdso.c b/lib/libc/internal/init/vdso.c index 73bfb46b..660bb74a 100644 --- a/lib/libc/internal/init/vdso.c +++ b/lib/libc/internal/init/vdso.c @@ -1,7 +1,9 @@ +#include "stddef.h" #include #include #include #include +#include int (*__vdso_clock_gettime)(int, struct timespec *) = 0; int (*__vdso_getcpu)(unsigned *, unsigned *, void *) = 0; -- cgit v1.2.3