summaryrefslogtreecommitdiff
path: root/src/common/assert.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/assert.h')
-rw-r--r--src/common/assert.h27
1 files changed, 15 insertions, 12 deletions
diff --git a/src/common/assert.h b/src/common/assert.h
index cd9b819a9..04e80c87a 100644
--- a/src/common/assert.h
+++ b/src/common/assert.h
@@ -5,7 +5,6 @@
#pragma once
#include <cstdlib>
-
#include "common/common_funcs.h"
#include "common/logging/log.h"
@@ -18,25 +17,29 @@
// enough for our purposes.
template <typename Fn>
#if defined(_MSC_VER)
- __declspec(noinline, noreturn)
+__declspec(noinline, noreturn)
#elif defined(__GNUC__)
__attribute__((noinline, noreturn, cold))
#endif
-static void assert_noinline_call(const Fn& fn) {
+ static void assert_noinline_call(const Fn& fn) {
fn();
Crash();
exit(1); // Keeps GCC's mouth shut about this actually returning
}
-#define ASSERT(_a_) \
- do if (!(_a_)) { assert_noinline_call([] { \
- LOG_CRITICAL(Debug, "Assertion Failed!"); \
- }); } while (0)
+#define ASSERT(_a_) \
+ do \
+ if (!(_a_)) { \
+ assert_noinline_call([] { LOG_CRITICAL(Debug, "Assertion Failed!"); }); \
+ } \
+ while (0)
-#define ASSERT_MSG(_a_, ...) \
- do if (!(_a_)) { assert_noinline_call([&] { \
- LOG_CRITICAL(Debug, "Assertion Failed!\n" __VA_ARGS__); \
- }); } while (0)
+#define ASSERT_MSG(_a_, ...) \
+ do \
+ if (!(_a_)) { \
+ assert_noinline_call([&] { LOG_CRITICAL(Debug, "Assertion Failed!\n" __VA_ARGS__); }); \
+ } \
+ while (0)
#define UNREACHABLE() ASSERT_MSG(false, "Unreachable code!")
#define UNREACHABLE_MSG(...) ASSERT_MSG(false, __VA_ARGS__)
@@ -50,4 +53,4 @@ static void assert_noinline_call(const Fn& fn) {
#endif
#define UNIMPLEMENTED() DEBUG_ASSERT_MSG(false, "Unimplemented code!")
-#define UNIMPLEMENTED_MSG(_a_, ...) ASSERT_MSG(false, _a_, __VA_ARGS__) \ No newline at end of file
+#define UNIMPLEMENTED_MSG(_a_, ...) ASSERT_MSG(false, _a_, __VA_ARGS__)