summaryrefslogtreecommitdiff
path: root/Source/Core/Common
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2015-09-26 16:39:47 -0400
committerLioncash <mathew1800@gmail.com>2015-09-26 18:51:27 -0400
commit19ac565e0dafccd3728b58a0d92cdc0cb74e4be0 (patch)
tree183bd4ec58aea5fcad4846572e60f5922ad8895d /Source/Core/Common
parent867df74b52cd03b1f82572d7870ca034476e7d89 (diff)
Common: Move asserts to their own header
Diffstat (limited to 'Source/Core/Common')
-rw-r--r--Source/Core/Common/Arm64Emitter.cpp1
-rw-r--r--Source/Core/Common/Arm64Emitter.h1
-rw-r--r--Source/Core/Common/Assert.h45
-rw-r--r--Source/Core/Common/ChunkFile.h2
-rw-r--r--Source/Core/Common/CodeBlock.h2
-rw-r--r--Source/Core/Common/Common.vcxproj1
-rw-r--r--Source/Core/Common/GL/GLUtil.cpp1
-rw-r--r--Source/Core/Common/Logging/Log.h41
-rw-r--r--Source/Core/Common/x64Emitter.h1
9 files changed, 53 insertions, 42 deletions
diff --git a/Source/Core/Common/Arm64Emitter.cpp b/Source/Core/Common/Arm64Emitter.cpp
index aa01434b43..16031372f4 100644
--- a/Source/Core/Common/Arm64Emitter.cpp
+++ b/Source/Core/Common/Arm64Emitter.cpp
@@ -6,6 +6,7 @@
#include <vector>
#include "Common/Arm64Emitter.h"
+#include "Common/Assert.h"
#include "Common/CommonTypes.h"
#include "Common/MathUtil.h"
diff --git a/Source/Core/Common/Arm64Emitter.h b/Source/Core/Common/Arm64Emitter.h
index 8ca8c001a0..3cb5dfe0a8 100644
--- a/Source/Core/Common/Arm64Emitter.h
+++ b/Source/Core/Common/Arm64Emitter.h
@@ -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"
diff --git a/Source/Core/Common/Assert.h b/Source/Core/Common/Assert.h
new file mode 100644
index 0000000000..bedcbdee48
--- /dev/null
+++ b/Source/Core/Common/Assert.h
@@ -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_)
diff --git a/Source/Core/Common/ChunkFile.h b/Source/Core/Common/ChunkFile.h
index fcf1bdb3e4..d3babbb11d 100644
--- a/Source/Core/Common/ChunkFile.h
+++ b/Source/Core/Common/ChunkFile.h
@@ -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
diff --git a/Source/Core/Common/CodeBlock.h b/Source/Core/Common/CodeBlock.h
index 864dac5e63..8f02f08336 100644
--- a/Source/Core/Common/CodeBlock.h
+++ b/Source/Core/Common/CodeBlock.h
@@ -4,7 +4,7 @@
#pragma once
-#include "Common/Common.h"
+#include "Common/Assert.h"
#include "Common/MemoryUtil.h"
#include "Common/NonCopyable.h"
diff --git a/Source/Core/Common/Common.vcxproj b/Source/Core/Common/Common.vcxproj
index 12cbc07e8a..f367557b2e 100644
--- a/Source/Core/Common/Common.vcxproj
+++ b/Source/Core/Common/Common.vcxproj
@@ -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" />
diff --git a/Source/Core/Common/GL/GLUtil.cpp b/Source/Core/Common/GL/GLUtil.cpp
index 3cb8499b0d..ece39e5a61 100644
--- a/Source/Core/Common/GL/GLUtil.cpp
+++ b/Source/Core/Common/GL/GLUtil.cpp
@@ -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"
diff --git a/Source/Core/Common/Logging/Log.h b/Source/Core/Common/Logging/Log.h
index 41d9aa503a..24a4aa8884 100644
--- a/Source/Core/Common/Logging/Log.h
+++ b/Source/Core/Common/Logging/Log.h
@@ -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_)
diff --git a/Source/Core/Common/x64Emitter.h b/Source/Core/Common/x64Emitter.h
index cd6a2bd03c..928478af49 100644
--- a/Source/Core/Common/x64Emitter.h
+++ b/Source/Core/Common/x64Emitter.h
@@ -10,6 +10,7 @@
#include <cstring>
#include <functional>
+#include "Common/Assert.h"
#include "Common/BitSet.h"
#include "Common/CodeBlock.h"
#include "Common/CommonTypes.h"