From 93b68432f2e7d3cd87663a44ca73b1adc9d645d2 Mon Sep 17 00:00:00 2001 From: Mark Pizzolato Date: Sat, 8 Mar 2014 06:01:21 -0800 Subject: [PATCH] AltairZ80, PDP10, PDP11, VAX: Fix incorrect sense of test on expression value in th ASSURE macro. Fix issue #126 --- sim_defs.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sim_defs.h b/sim_defs.h index 743097c6..d2cfd5c7 100644 --- a/sim_defs.h +++ b/sim_defs.h @@ -747,10 +747,11 @@ 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) {fprintf(stderr, "%s failed at %s line %d\n", #_Expression, __FILE__, __LINE__); \ - if (sim_log) fprintf(sim_log, "%s failed at %s line %d\n", #_Expression, __FILE__, __LINE__); \ - if (sim_deb) fprintf(sim_deb, "%s failed at %s line %d\n", #_Expression, __FILE__, __LINE__); \ - abort();} else (void)0 +#define ASSURE(_Expression) if (!(_Expression)) {char *_exp = #_Expression; 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 /* Asynch/Threaded I/O support */