diff options
author | Lenny Maiorani <lenny@colorado.edu> | 2020-12-20 16:09:48 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-12-21 00:09:48 +0100 |
commit | 765936ebaedfaa3a339d99a9865b555ddd7c23e2 (patch) | |
tree | e092294ec99ca5b3ba9c92139f847dcd9a8a20bc /Kernel/Arch | |
parent | 4421d98e30763424055eefe729c9cab28abdf19d (diff) | |
download | serenity-765936ebaedfaa3a339d99a9865b555ddd7c23e2.zip |
Everywhere: Switch from (void) to [[maybe_unused]] (#4473)
Problem:
- `(void)` simply casts the expression to void. This is understood to
indicate that it is ignored, but this is really a compiler trick to
get the compiler to not generate a warning.
Solution:
- Use the `[[maybe_unused]]` attribute to indicate the value is unused.
Note:
- Functions taking a `(void)` argument list have also been changed to
`()` because this is not needed and shows up in the same grep
command.
Diffstat (limited to 'Kernel/Arch')
-rw-r--r-- | Kernel/Arch/i386/CPU.cpp | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/Kernel/Arch/i386/CPU.cpp b/Kernel/Arch/i386/CPU.cpp index 0df5f639b7..b863ab2597 100644 --- a/Kernel/Arch/i386/CPU.cpp +++ b/Kernel/Arch/i386/CPU.cpp @@ -64,9 +64,9 @@ static GenericInterruptHandler* s_interrupt_handler[GENERIC_INTERRUPT_HANDLERS_C extern "C" void enter_thread_context(Thread* from_thread, Thread* to_thread); extern "C" void context_first_init(Thread* from_thread, Thread* to_thread, TrapFrame* trap); extern "C" u32 do_init_context(Thread* thread, u32 flags); -extern "C" void exit_kernel_thread(void); -extern "C" void pre_init_finished(void); -extern "C" void post_init_finished(void); +extern "C" void exit_kernel_thread(); +extern "C" void pre_init_finished(); +extern "C" void post_init_finished(); extern "C" void handle_interrupt(TrapFrame*); #define EH_ENTRY(ec, title) \ @@ -1490,13 +1490,10 @@ void Processor::switch_context(Thread*& from_thread, Thread*& to_thread) #endif } -extern "C" void context_first_init(Thread* from_thread, Thread* to_thread, TrapFrame* trap) +extern "C" void context_first_init([[maybe_unused]] Thread* from_thread, [[maybe_unused]] Thread* to_thread, [[maybe_unused]] TrapFrame* trap) { ASSERT(!are_interrupts_enabled()); ASSERT(is_kernel_mode()); - (void)from_thread; - (void)to_thread; - (void)trap; #ifdef CONTEXT_SWITCH_DEBUG dbg() << "switch_context <-- from " << VirtualAddress(from_thread) << " " << *from_thread << " to " << VirtualAddress(to_thread) << " " << *to_thread << " (context_first_init)"; @@ -1513,7 +1510,7 @@ extern "C" void context_first_init(Thread* from_thread, Thread* to_thread, TrapF Scheduler::leave_on_first_switch(trap->regs->eflags); } -extern "C" void thread_context_first_enter(void); +extern "C" void thread_context_first_enter(); asm( // enter_thread_context returns to here first time a thread is executing ".globl thread_context_first_enter \n" @@ -1529,7 +1526,7 @@ asm( " jmp common_trap_exit \n" ); -void exit_kernel_thread(void) +void exit_kernel_thread() { Thread::current()->exit(); } @@ -1674,7 +1671,7 @@ void Processor::assume_context(Thread& thread, u32 flags) ASSERT_NOT_REACHED(); } -extern "C" void pre_init_finished(void) +extern "C" void pre_init_finished() { ASSERT(g_scheduler_lock.own_lock()); @@ -1687,7 +1684,7 @@ extern "C" void pre_init_finished(void) Scheduler::leave_on_first_switch(prev_flags); } -extern "C" void post_init_finished(void) +extern "C" void post_init_finished() { // We need to re-acquire the scheduler lock before a context switch // transfers control into the idle loop, which needs the lock held @@ -1731,7 +1728,7 @@ void Processor::initialize_context_switching(Thread& initial_thread) [from_to_thread] "b" (&initial_thread), [cpu] "c" (id()) ); - + ASSERT_NOT_REACHED(); } |