aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/common/assert.h
diff options
context:
space:
mode:
authorGravatar Yuri Kunde Schlesner <yuriks@yuriks.net>2015-05-15 20:54:48 -0700
committerGravatar Yuri Kunde Schlesner <yuriks@yuriks.net>2015-05-15 20:54:48 -0700
commitba2fe7f795ebc8da4acd247436afeefb900645d3 (patch)
treebe9a2cbcdd840f41be5353a33a98bff3ca31544e /src/common/assert.h
parent742fd191a955d9971b527b25f366820ff5ddbf7b (diff)
parent7dbc27ff57d24a1c4e04e3f8cc35773ff9288516 (diff)
Merge pull request #758 from yuriks/sync-logging
Common: Remove async logging
Diffstat (limited to 'src/common/assert.h')
-rw-r--r--src/common/assert.h10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/common/assert.h b/src/common/assert.h
index 4f26c63e..7b7d8bf2 100644
--- a/src/common/assert.h
+++ b/src/common/assert.h
@@ -8,6 +8,7 @@
#include <cstdlib>
#include "common/common_funcs.h"
+#include "common/logging/log.h"
// For asserts we'd like to keep all the junk executed when an assert happens away from the
// important code in the function. One way of doing this is to put all the relevant code inside a
@@ -28,19 +29,14 @@ static void assert_noinline_call(const Fn& fn) {
exit(1); // Keeps GCC's mouth shut about this actually returning
}
-// TODO (yuriks) allow synchronous logging so we don't need printf
#define ASSERT(_a_) \
do if (!(_a_)) { assert_noinline_call([] { \
- fprintf(stderr, "Assertion Failed!\n\n Line: %d\n File: %s\n Time: %s\n", \
- __LINE__, __FILE__, __TIME__); \
+ LOG_CRITICAL(Debug, "Assertion Failed!"); \
}); } while (0)
#define ASSERT_MSG(_a_, ...) \
do if (!(_a_)) { assert_noinline_call([&] { \
- fprintf(stderr, "Assertion Failed!\n\n Line: %d\n File: %s\n Time: %s\n", \
- __LINE__, __FILE__, __TIME__); \
- fprintf(stderr, __VA_ARGS__); \
- fprintf(stderr, "\n"); \
+ LOG_CRITICAL(Debug, "Assertion Failed!\n" __VA_ARGS__); \
}); } while (0)
#define UNREACHABLE() ASSERT_MSG(false, "Unreachable code!")