From 310c1f50beb77fc5c6f9075029973161d4e51a4a Mon Sep 17 00:00:00 2001 From: FearlessTobi Date: Mon, 19 Feb 2024 16:00:46 +0100 Subject: scope_exit: Make constexpr Allows the use of the macro in constexpr-contexts. Also avoids some potential problems when nesting braces inside it. --- src/core/hle/kernel/k_process.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'src/core/hle/kernel/k_process.cpp') diff --git a/src/core/hle/kernel/k_process.cpp b/src/core/hle/kernel/k_process.cpp index 1bcc42890..cb9a11a63 100644 --- a/src/core/hle/kernel/k_process.cpp +++ b/src/core/hle/kernel/k_process.cpp @@ -77,7 +77,9 @@ Result TerminateChildren(KernelCore& kernel, KProcess* process, } // Terminate and close the thread. - SCOPE_EXIT({ cur_child->Close(); }); + SCOPE_EXIT { + cur_child->Close(); + }; if (const Result terminate_result = cur_child->Terminate(); ResultTerminationRequested == terminate_result) { @@ -466,11 +468,11 @@ void KProcess::DoWorkerTaskImpl() { Result KProcess::StartTermination() { // Finalize the handle table when we're done, if the process isn't immortal. - SCOPE_EXIT({ + SCOPE_EXIT { if (!m_is_immortal) { this->FinalizeHandleTable(); } - }); + }; // Terminate child threads other than the current one. R_RETURN(TerminateChildren(m_kernel, this, GetCurrentThreadPointer(m_kernel))); @@ -964,7 +966,9 @@ Result KProcess::Run(s32 priority, size_t stack_size) { // Create a new thread for the process. KThread* main_thread = KThread::Create(m_kernel); R_UNLESS(main_thread != nullptr, ResultOutOfResource); - SCOPE_EXIT({ main_thread->Close(); }); + SCOPE_EXIT { + main_thread->Close(); + }; // Initialize the thread. R_TRY(KThread::InitializeUserThread(m_kernel.System(), main_thread, this->GetEntryPoint(), 0, @@ -1155,7 +1159,9 @@ Result KProcess::LoadFromMetadata(const FileSys::ProgramMetadata& metadata, std: Kernel::CreateResourceLimitForProcess(m_kernel.System(), physical_memory_size); // Ensure we maintain a clean state on exit. - SCOPE_EXIT({ res_limit->Close(); }); + SCOPE_EXIT { + res_limit->Close(); + }; // Declare flags and code address. Svc::CreateProcessFlag flag{}; -- cgit v1.2.3