wasm: Better implementation of roc_panic in tests

This commit is contained in:
Brian Carroll 2022-02-11 07:33:49 +00:00
parent 2af4016f34
commit 5f64f32a4a

View file

@ -1,4 +1,5 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
// Makes test runs take 50% longer, due to linking // Makes test runs take 50% longer, due to linking
#define ENABLE_PRINTF 0 #define ENABLE_PRINTF 0
@ -121,14 +122,13 @@ void roc_dealloc(void *ptr, unsigned int alignment)
//-------------------------- //--------------------------
void roc_panic(void *ptr, unsigned int alignment) void roc_panic(char *msg, unsigned int tag_id)
{ {
#if ENABLE_PRINTF // Note: no dynamic string formatting
char *msg = (char *)ptr; fputs("Application crashed with message\n\n ", stderr);
fprintf(stderr, fputs(msg, stderr);
"Application crashed with message\n\n %s\n\nShutting down\n", msg); fputs("\n\nShutting down\n", stderr);
#endif exit(101);
abort();
} }
//-------------------------- //--------------------------