From 5bfec866b16aba9337b58f17d5d3103aad72ce54 Mon Sep 17 00:00:00 2001 From: kalaposfos13 <153381648+kalaposfos13@users.noreply.github.com> Date: Thu, 30 Apr 2026 18:42:54 +0200 Subject: [PATCH] Change ASSERT macros to be do while loops instead of lambdas to preserve original function names in the log (#4337) * Change ASSERT macros to be do while loops instead of lambdas to preserve original function names in the log * copyright 2026 --- src/common/assert.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/common/assert.h b/src/common/assert.h index dabeb111f..63bd1257e 100644 --- a/src/common/assert.h +++ b/src/common/assert.h @@ -1,5 +1,6 @@ // SPDX-FileCopyrightText: 2013 Dolphin Emulator Project // SPDX-FileCopyrightText: 2014 Citra Emulator Project +// SPDX-FileCopyrightText: Copyright 2026 shadPS4 Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later #pragma once @@ -20,20 +21,20 @@ void assert_fail_impl(); #endif #define ASSERT(_a_) \ - ([&]() SHAD_NO_INLINE { \ + do { \ if (!(_a_)) [[unlikely]] { \ LOG_CRITICAL(Debug, "Assertion Failed!"); \ assert_fail_impl(); \ } \ - }()) + } while (false) #define ASSERT_MSG(_a_, ...) \ - ([&]() SHAD_NO_INLINE { \ + do { \ if (!(_a_)) [[unlikely]] { \ LOG_CRITICAL(Debug, "Assertion Failed!\n" __VA_ARGS__); \ assert_fail_impl(); \ } \ - }()) + } while (false) #define UNREACHABLE() \ do { \