Common: Move asserts to their own header

This commit is contained in:
Lioncash 2015-09-26 16:39:47 -04:00
parent 867df74b52
commit 19ac565e0d
23 changed files with 73 additions and 47 deletions

View File

@ -6,6 +6,7 @@
#include <vector>
#include "Common/Arm64Emitter.h"
#include "Common/Assert.h"
#include "Common/CommonTypes.h"
#include "Common/MathUtil.h"

View File

@ -7,6 +7,7 @@
#include <functional>
#include "Common/ArmCommon.h"
#include "Common/Assert.h"
#include "Common/BitSet.h"
#include "Common/CodeBlock.h"
#include "Common/Common.h"

View File

@ -0,0 +1,45 @@
// Copyright 2015 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#pragma once
#include "Common/CommonFuncs.h"
#include "Common/MsgHandler.h"
#include "Common/Logging/Log.h"
#ifdef _WIN32
#define _assert_msg_(_t_, _a_, _fmt_, ...) \
if (!(_a_)) {\
if (!PanicYesNo(_fmt_, __VA_ARGS__)) \
Crash(); \
}
#define _dbg_assert_msg_(_t_, _a_, _msg_, ...)\
if (MAX_LOGLEVEL >= LogTypes::LOG_LEVELS::LDEBUG && !(_a_)) {\
ERROR_LOG(_t_, _msg_, __VA_ARGS__); \
if (!PanicYesNo(_msg_, __VA_ARGS__)) \
Crash(); \
}
#else
#define _assert_msg_(_t_, _a_, _fmt_, ...) \
if (!(_a_)) {\
if (!PanicYesNo(_fmt_, ##__VA_ARGS__)) \
Crash(); \
}
#define _dbg_assert_msg_(_t_, _a_, _msg_, ...)\
if (MAX_LOGLEVEL >= LogTypes::LOG_LEVELS::LDEBUG && !(_a_)) {\
ERROR_LOG(_t_, _msg_, ##__VA_ARGS__); \
if (!PanicYesNo(_msg_, ##__VA_ARGS__)) \
Crash(); \
}
#endif
#define _assert_(_a_) \
_assert_msg_(MASTER_LOG, _a_, "Error...\n\n Line: %d\n File: %s\n Time: %s\n\nIgnore and continue?", \
__LINE__, __FILE__, __TIME__)
#define _dbg_assert_(_t_, _a_) \
if (MAX_LOGLEVEL >= LogTypes::LOG_LEVELS::LDEBUG) \
_assert_(_a_)

View File

@ -24,9 +24,11 @@
#include <utility>
#include <vector>
#include "Common/Assert.h"
#include "Common/CommonTypes.h"
#include "Common/FileUtil.h"
#include "Common/Flag.h"
#include "Common/Logging/Log.h"
// ewww
#if _LIBCPP_VERSION || __GNUC__ >= 5

View File

@ -4,7 +4,7 @@
#pragma once
#include "Common/Common.h"
#include "Common/Assert.h"
#include "Common/MemoryUtil.h"
#include "Common/NonCopyable.h"

View File

@ -35,6 +35,7 @@
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<ItemGroup>
<ClInclude Include="Assert.h" />
<ClInclude Include="Atomic.h" />
<ClInclude Include="Atomic_GCC.h" />
<ClInclude Include="Atomic_Win32.h" />

View File

@ -2,6 +2,7 @@
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include "Common/Assert.h"
#include "Common/GL/GLInterfaceBase.h"
#include "Common/GL/GLUtil.h"
#include "Common/Logging/Log.h"

View File

@ -4,9 +4,6 @@
#pragma once
#include "Common/CommonFuncs.h"
#include "Common/MsgHandler.h"
namespace LogTypes
{
@ -101,41 +98,3 @@ void GenericLog(LogTypes::LOG_LEVELS level, LogTypes::LOG_TYPE type,
#define NOTICE_LOG(t,...) do { GENERIC_LOG(LogTypes::t, LogTypes::LNOTICE, __VA_ARGS__) } while (0)
#define INFO_LOG(t,...) do { GENERIC_LOG(LogTypes::t, LogTypes::LINFO, __VA_ARGS__) } while (0)
#define DEBUG_LOG(t,...) do { GENERIC_LOG(LogTypes::t, LogTypes::LDEBUG, __VA_ARGS__) } while (0)
#ifdef _WIN32
#define _dbg_assert_msg_(_t_, _a_, _msg_, ...)\
if (MAX_LOGLEVEL >= LogTypes::LOG_LEVELS::LDEBUG && !(_a_)) {\
ERROR_LOG(_t_, _msg_, __VA_ARGS__); \
if (!PanicYesNo(_msg_, __VA_ARGS__)) \
Crash(); \
}
#else
#define _dbg_assert_msg_(_t_, _a_, _msg_, ...)\
if (MAX_LOGLEVEL >= LogTypes::LOG_LEVELS::LDEBUG && !(_a_)) {\
ERROR_LOG(_t_, _msg_, ##__VA_ARGS__); \
if (!PanicYesNo(_msg_, ##__VA_ARGS__)) \
Crash(); \
}
#endif
#ifdef _WIN32
#define _assert_msg_(_t_, _a_, _fmt_, ...) \
if (!(_a_)) {\
if (!PanicYesNo(_fmt_, __VA_ARGS__)) \
Crash(); \
}
#else // not win32
#define _assert_msg_(_t_, _a_, _fmt_, ...) \
if (!(_a_)) {\
if (!PanicYesNo(_fmt_, ##__VA_ARGS__)) \
Crash(); \
}
#endif // WIN32
#define _assert_(_a_) \
_assert_msg_(MASTER_LOG, _a_, "Error...\n\n Line: %d\n File: %s\n Time: %s\n\nIgnore and continue?", \
__LINE__, __FILE__, __TIME__)
#define _dbg_assert_(_t_, _a_) \
if (MAX_LOGLEVEL >= LogTypes::LOG_LEVELS::LDEBUG) \
_assert_(_a_)

View File

@ -10,6 +10,7 @@
#include <cstring>
#include <functional>
#include "Common/Assert.h"
#include "Common/BitSet.h"
#include "Common/CodeBlock.h"
#include "Common/CommonTypes.h"

View File

@ -2,10 +2,10 @@
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include "Common/Assert.h"
#include "Core/ConfigManager.h"
#include "Core/Core.h"
#include "Core/FifoPlayer/FifoAnalyzer.h"
#include "VideoCommon/VertexLoader.h"
#include "VideoCommon/VertexLoader_Normal.h"
#include "VideoCommon/VertexLoader_Position.h"

View File

@ -2,12 +2,11 @@
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include "Common/Assert.h"
#include "Common/CommonTypes.h"
#include "Core/FifoPlayer/FifoAnalyzer.h"
#include "Core/FifoPlayer/FifoDataFile.h"
#include "Core/FifoPlayer/FifoPlaybackAnalyzer.h"
#include "VideoCommon/OpcodeDecoding.h"
#include "VideoCommon/TextureDecoder.h"
#include "VideoCommon/VertexLoader.h"

View File

@ -5,6 +5,7 @@
#include <algorithm>
#include <mutex>
#include "Common/Assert.h"
#include "Common/CommonTypes.h"
#include "Core/ConfigManager.h"
#include "Core/Core.h"

View File

@ -4,12 +4,12 @@
#include <algorithm>
#include "Common/Assert.h"
#include "Core/Core.h"
#include "Core/FifoPlayer/FifoAnalyzer.h"
#include "Core/FifoPlayer/FifoRecordAnalyzer.h"
#include "Core/FifoPlayer/FifoRecorder.h"
#include "Core/HW/Memmap.h"
#include "VideoCommon/OpcodeDecoding.h"
#include "VideoCommon/TextureDecoder.h"

View File

@ -8,6 +8,7 @@
#include <string>
#include <type_traits>
#include "Common/Assert.h"
#include "Common/CommonTypes.h"
#include "Core/ConfigManager.h"
#include "Core/HW/MMIOHandlers.h"

View File

@ -4,7 +4,8 @@
#include <vector>
#include "Common/Common.h"
#include "Common/Assert.h"
#include "Common/CommonTypes.h"
#include "Common/MsgHandler.h"
#include "Common/Logging/Log.h"
#include "Core/IPC_HLE/WiiMote_HID_Attr.h"

View File

@ -6,6 +6,8 @@
#include <cinttypes>
#include <string>
#include "Common/Assert.h"
#include "Common/CommonTypes.h"
#include "Common/GekkoDisassembler.h"
#include "Common/StringUtil.h"
#include "Core/Host.h"

View File

@ -2,6 +2,8 @@
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include "Common/Assert.h"
#include "Common/CommonTypes.h"
#include "Core/PowerPC/PPCAnalyst.h"
#include "Core/PowerPC/Interpreter/Interpreter.h"

View File

@ -2,6 +2,8 @@
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include "Common/Assert.h"
#include "Common/CommonTypes.h"
#include "Common/MathUtil.h"
#include "Core/PowerPC/Interpreter/Interpreter.h"
#include "Core/PowerPC/Interpreter/Interpreter_FPUtils.h"

View File

@ -2,6 +2,8 @@
// Licensed under GPLv2+
// Refer to the license.txt file included.
#include "Common/Assert.h"
#include "Common/CommonTypes.h"
#include "Common/CPUDetect.h"
#include "Common/FPURoundMode.h"
#include "Core/HW/GPFifo.h"

View File

@ -10,10 +10,12 @@
#include <string>
#include <vector>
#include "Common/Assert.h"
#include "Common/CommonPaths.h"
#include "Common/CommonTypes.h"
#include "Common/FileUtil.h"
#include "Common/MathUtil.h"
#include "Common/Logging/Log.h"
#include "DiscIO/FileBlob.h"
#include "DiscIO/FileMonitor.h"
#include "DiscIO/Volume.h"

View File

@ -7,6 +7,7 @@
#include <memory>
#include <string>
#include "Common/Assert.h"
#include "Common/CommonTypes.h"
#include "Common/FileUtil.h"
#include "Common/MathUtil.h"

View File

@ -25,6 +25,7 @@
#include <wx/stattext.h>
#include <wx/textctrl.h>
#include "Common/Assert.h"
#include "Common/CommonTypes.h"
#include "Core/FifoPlayer/FifoDataFile.h"
#include "Core/FifoPlayer/FifoPlaybackAnalyzer.h"

View File

@ -7,6 +7,7 @@
#include <map>
#include <unistd.h>
#include "Common/Assert.h"
#include "Common/Logging/Log.h"
#include "InputCommon/ControllerInterface/evdev/evdev.h"