Debian Codegraph @

Source/Core/Common/Assert.h

raw symbols SCIP
1 // Copyright 2015 Dolphin Emulator Project
2 // SPDX-License-Identifier: GPL-2.0-or-later
3
4 #pragma once
5
6 #include "Common/Common.h"
7 #include "Common/CommonFuncs.h"
8 #include "Common/Logging/Log.h"
9 #include "Common/MsgHandler.h"
10
11 #define ASSERT_MSG(_t_, _a_, _fmt_, ...) \
12 do \
13 { \
14 if (!(_a_)) [[unlikely]] \
15 { \
16 if (!PanicYesNoFmtAssert(_t_, \
17 "An error occurred.\n\n" _fmt_ "\n\n" \
18 " Condition: {}\n File: {}\n Line: {}\n Function: {}\n\n" \
19 "Ignore and continue?", \
20 __VA_ARGS__ __VA_OPT__(, ) #_a_, __FILE__, __LINE__, __func__)) \
21 Crash(); \
22 } \
23 } while (0)
24
25 #define DEBUG_ASSERT_MSG(_t_, _a_, _fmt_, ...) \
26 do \
27 { \
28 if constexpr (Common::Log::MAX_EFFECTIVE_LOGLEVEL >= Common::Log::LogLevel::LDEBUG) \
29 ASSERT_MSG(_t_, _a_, _fmt_ __VA_OPT__(, ) __VA_ARGS__); \
30 } while (0)
31
32 #define ASSERT(_a_) \
33 do \
34 { \
35 if (!(_a_)) [[unlikely]] \
36 { \
37 if (!PanicYesNoFmt("An error occurred.\n\n" \
38 " Condition: {}\n File: {}\n Line: {}\n Function: {}\n\n" \
39 "Ignore and continue?", \
40 #_a_, __FILE__, __LINE__, __func__)) \
41 Crash(); \
42 } \
43 } while (0)
44
45 #define DEBUG_ASSERT(_a_) \
46 do \
47 { \
48 if constexpr (Common::Log::MAX_EFFECTIVE_LOGLEVEL >= Common::Log::LogLevel::LDEBUG) \
49 ASSERT(_a_); \
50 } while (0)