Commit 52b367b5 authored by Bradley C. Kuszmaul's avatar Bradley C. Kuszmaul

Create continuable assertion failures. See #835 for how to use it. Fixes #835.

git-svn-id: file:///svn/tokudb@3989 c7de825b-a66e-492c-adef-691d508d4ae1
parent 2f47bef9
...@@ -2,9 +2,20 @@ ...@@ -2,9 +2,20 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
int toku_continue_on_assert_failure=0;
void toku_assert_failed_but_continue_anyway (void) __attribute__((noinline));
void toku_assert_failed_but_continue_anyway (void) {
printf("Assertion failed, but continuing anyway\n");
}
void toku_do_assert(int expr,const char* expr_as_string,const char *function,const char*file,int line) { void toku_do_assert(int expr,const char* expr_as_string,const char *function,const char*file,int line) {
if (expr==0) { if (expr==0) {
fprintf(stderr, "%s:%d %s: Assertion `%s' failed\n", file,line,function,expr_as_string); fprintf(stderr, "%s:%d %s: Assertion `%s' failed\n", file,line,function,expr_as_string);
if (!toku_continue_on_assert_failure)
abort(); abort();
else
toku_assert_failed_but_continue_anyway();
} }
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment