Merge "Make tests/libs/CHECK.h work on the host" into main
This commit is contained in:
commit
3abc30d6a6
1 changed files with 10 additions and 2 deletions
|
@ -20,7 +20,15 @@
|
|||
// should probably avoid dependencies other than ones we're specifically
|
||||
// trying to test.
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
static inline void check_failure(const char* file, int line, const char* function,
|
||||
const char* failed_expression) {
|
||||
fprintf(stderr, "%s:%d: %s: assertion \"%s\" failed\n", file, line, function, failed_expression);
|
||||
fflush(stderr);
|
||||
abort();
|
||||
}
|
||||
|
||||
#define CHECK(e) \
|
||||
((e) ? static_cast<void>(0) : __assert2(__FILE__, __LINE__, __PRETTY_FUNCTION__, #e))
|
||||
((e) ? static_cast<void>(0) : check_failure(__FILE__, __LINE__, __PRETTY_FUNCTION__, #e))
|
||||
|
|
Loading…
Reference in a new issue