ALL: changed ASSURE macro to leverage sim_printf for log and debug output.
This commit is contained in:
parent
9ee290ac49
commit
7266304105
1 changed files with 6 additions and 5 deletions
11
sim_defs.h
11
sim_defs.h
|
@ -108,6 +108,9 @@
|
|||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#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 <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
@ -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 */
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue