2013-04-16 23:57:29 -04:00
|
|
|
#include "toku_portability.h"
|
2013-04-16 23:57:22 -04:00
|
|
|
#include "toku_assert.h"
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
2008-02-07 16:35:39 +00:00
|
|
|
|
2008-05-17 01:06:03 +00:00
|
|
|
int toku_continue_on_assert_failure=0;
|
|
|
|
|
2013-04-16 23:57:20 -04:00
|
|
|
static void toku_assert_failed_but_continue_anyway (void) __attribute__((noinline));
|
2008-05-17 01:06:03 +00:00
|
|
|
|
2013-04-16 23:57:20 -04:00
|
|
|
static void
|
|
|
|
toku_assert_failed_but_continue_anyway (void) {
|
2008-05-17 01:06:03 +00:00
|
|
|
printf("Assertion failed, but continuing anyway\n");
|
|
|
|
}
|
|
|
|
|
2008-04-02 23:40:36 +00:00
|
|
|
void toku_do_assert(int expr,const char* expr_as_string,const char *function,const char*file,int line) {
|
2008-02-07 16:35:39 +00:00
|
|
|
if (expr==0) {
|
|
|
|
fprintf(stderr, "%s:%d %s: Assertion `%s' failed\n", file,line,function,expr_as_string);
|
2008-05-17 01:06:03 +00:00
|
|
|
if (!toku_continue_on_assert_failure)
|
|
|
|
abort();
|
|
|
|
else
|
|
|
|
toku_assert_failed_but_continue_anyway();
|
2008-02-07 16:35:39 +00:00
|
|
|
}
|
|
|
|
}
|