2015-09-26 20:39:47 +00:00
|
|
|
// Copyright 2015 Dolphin Emulator Project
|
2021-07-05 01:22:19 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2015-09-26 20:39:47 +00:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2015-11-20 10:33:47 +00:00
|
|
|
#include "Common/Common.h"
|
2015-09-26 20:39:47 +00:00
|
|
|
#include "Common/CommonFuncs.h"
|
|
|
|
#include "Common/Logging/Log.h"
|
|
|
|
#include "Common/MsgHandler.h"
|
|
|
|
|
2018-03-15 00:34:35 +00:00
|
|
|
#define ASSERT_MSG(_t_, _a_, _fmt_, ...) \
|
2018-03-16 16:06:24 +00:00
|
|
|
do \
|
2015-09-26 20:39:47 +00:00
|
|
|
{ \
|
2018-03-16 16:06:24 +00:00
|
|
|
if (!(_a_)) \
|
|
|
|
{ \
|
|
|
|
if (!PanicYesNo(_fmt_, ##__VA_ARGS__)) \
|
|
|
|
Crash(); \
|
|
|
|
} \
|
|
|
|
} while (0)
|
2015-09-26 20:39:47 +00:00
|
|
|
|
2018-03-15 00:34:35 +00:00
|
|
|
#define DEBUG_ASSERT_MSG(_t_, _a_, _msg_, ...) \
|
2018-03-16 16:06:24 +00:00
|
|
|
do \
|
2015-09-26 20:39:47 +00:00
|
|
|
{ \
|
2020-08-22 01:59:51 +00:00
|
|
|
if constexpr (MAX_LOGLEVEL >= Common::Log::LOG_LEVELS::LDEBUG) \
|
2018-03-16 16:06:24 +00:00
|
|
|
{ \
|
2020-08-22 01:59:51 +00:00
|
|
|
if (!(_a_)) \
|
|
|
|
{ \
|
|
|
|
ERROR_LOG(_t_, _msg_, ##__VA_ARGS__); \
|
|
|
|
if (!PanicYesNo(_msg_, ##__VA_ARGS__)) \
|
|
|
|
Crash(); \
|
|
|
|
} \
|
2018-03-16 16:06:24 +00:00
|
|
|
} \
|
|
|
|
} while (0)
|
2015-09-26 20:39:47 +00:00
|
|
|
|
2018-03-15 00:34:35 +00:00
|
|
|
#define ASSERT(_a_) \
|
2018-03-16 16:06:24 +00:00
|
|
|
do \
|
|
|
|
{ \
|
|
|
|
ASSERT_MSG(MASTER_LOG, _a_, \
|
|
|
|
_trans("An error occurred.\n\n Line: %d\n File: %s\n\nIgnore and continue?"), \
|
|
|
|
__LINE__, __FILE__); \
|
|
|
|
} while (0)
|
2015-09-26 20:39:47 +00:00
|
|
|
|
2018-03-16 16:57:36 +00:00
|
|
|
#define DEBUG_ASSERT(_a_) \
|
2018-03-16 16:06:24 +00:00
|
|
|
do \
|
|
|
|
{ \
|
2020-08-22 01:59:51 +00:00
|
|
|
if constexpr (MAX_LOGLEVEL >= Common::Log::LOG_LEVELS::LDEBUG) \
|
2018-03-16 16:06:24 +00:00
|
|
|
ASSERT(_a_); \
|
|
|
|
} while (0)
|