diff options
Diffstat (limited to 'src/Common')
| -rw-r--r-- | src/Common/Assert.hpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/Common/Assert.hpp b/src/Common/Assert.hpp index 9fc84ce..d30e724 100644 --- a/src/Common/Assert.hpp +++ b/src/Common/Assert.hpp @@ -1,6 +1,8 @@ #pragma once #include <csignal> +#include <cstdio> +#include <cstring> // https://stackoverflow.com/a/26100478/11342122 // Two levels are needed to make sure that the argument is expanded before stringification @@ -12,8 +14,8 @@ #define _ASSERT_STOP (_ASSERT_IS_DEFINED(NDEBUG) ? std::abort() : (void)raise(SIGTRAP)) // Assertion message macros, with optional message -#define _ASSERT_NOTIFY_NO_MESSAGE(start) std::fprintf(stderr, start ".\n", __FILE__, __LINE__) -#define _ASSERT_NOTIFY_WITH_MESSAGE(start, message) std::fprintf(stderr, start ": %s\n", __FILE__, __LINE__, message "") +#define _ASSERT_NOTIFY_NO_MESSAGE(start) fprintf(stderr, start ".\n", __FILE__, __LINE__) +#define _ASSERT_NOTIFY_WITH_MESSAGE(start, message) fprintf(stderr, start ": %s\n", __FILE__, __LINE__, message "") #define _ASSERT_NOTIFY(start, ...) ((strcmp(__VA_ARGS__ "", "") == 0) ? _ASSERT_NOTIFY_NO_MESSAGE(start) : _ASSERT_NOTIFY_WITH_MESSAGE(start, __VA_ARGS__)) // Debuggable assertion macro, with optional message |
