diff --git a/sim_defs.h b/sim_defs.h index b98ae56c..507446e4 100644 --- a/sim_defs.h +++ b/sim_defs.h @@ -108,6 +108,9 @@ #include #include #include +#if defined(_MSC_VER) && (_MSC_VER < 1900) +#define snprintf _snprintf /* poor man's snprintf which will work most of the time but has different return value */ +#endif #include #include #include @@ -844,11 +847,9 @@ typedef struct sim_bitfield BITFIELD; /* This replaces any references to "assert()" which should never be invoked */ /* with an expression which causes side effects (i.e. must be executed for */ /* the program to work correctly) */ -#define ASSURE(_Expression) if (!(_Expression)) {const char *_exp = #_Expression; const char *_file = __FILE__; \ - fprintf(stderr, "%s failed at %s line %d\n", _exp, _file, __LINE__); \ - if (sim_log) fprintf(sim_log, "%s failed at %s line %d\n", _exp, _file, __LINE__); \ - if (sim_deb) fprintf(sim_deb, "%s failed at %s line %d\n", _exp, _file, __LINE__); \ - abort();} else (void)0 +#define ASSURE(_Expression) while (!(_Expression)) {fprintf(stderr, "%s failed at %s line %d\n", #_Expression, __FILE__, __LINE__); \ + sim_printf("%s failed at %s line %d\n", #_Expression, __FILE__, __LINE__); \ + abort();} /* Asynch/Threaded I/O support */