Print more information when an assertion fails in test suite (#649)
authorHood Chatham <hood@mit.edu>
Sun, 27 Jun 2021 18:02:33 +0000 (11:02 -0700)
committerGitHub <noreply@github.com>
Sun, 27 Jun 2021 18:02:33 +0000 (14:02 -0400)
testsuite/libffi.call/ffitest.h
testsuite/libffi.closures/ffitest.h

index cfce1ad..95d96a8 100644 (file)
 
 #define MAX_ARGS 256
 
-#define CHECK(x) (void)(!(x) ? (abort(), 1) : 0)
+#define CHECK(x) \
+   do { \
+      if(!(x)){ \
+         printf("Check failed:\n%s\n", #x); \
+         abort(); \
+      } \
+   } while(0)
 
 /* Define macros so that compilers other than gcc can run the tests.  */
 #undef __UNUSED__
index cfce1ad..95d96a8 100644 (file)
 
 #define MAX_ARGS 256
 
-#define CHECK(x) (void)(!(x) ? (abort(), 1) : 0)
+#define CHECK(x) \
+   do { \
+      if(!(x)){ \
+         printf("Check failed:\n%s\n", #x); \
+         abort(); \
+      } \
+   } while(0)
 
 /* Define macros so that compilers other than gcc can run the tests.  */
 #undef __UNUSED__