diff options
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2016-09-18 09:38:01 +0900 |
---|---|---|
committer | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2016-09-18 09:38:01 +0900 |
commit | dc8479928c5aee4c6ad6fe4f59006fb604cee701 (patch) | |
tree | 569a7f13128450bbab973236615587ff00bced5f /src/common/assert.h | |
parent | fe948af0952d7badacbce62a8e35a3a1421245ba (diff) |
Sources: Run clang-format on everything.
Diffstat (limited to 'src/common/assert.h')
-rw-r--r-- | src/common/assert.h | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/src/common/assert.h b/src/common/assert.h index cd9b819a97..70214efae6 100644 --- a/src/common/assert.h +++ b/src/common/assert.h @@ -18,25 +18,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_MSG(_a_, ...) \ - do if (!(_a_)) { assert_noinline_call([&] { \ - LOG_CRITICAL(Debug, "Assertion Failed!\n" __VA_ARGS__); \ - }); } 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 UNREACHABLE() ASSERT_MSG(false, "Unreachable code!") #define UNREACHABLE_MSG(...) ASSERT_MSG(false, __VA_ARGS__) |