#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__
#define __STDCALL__ __attribute__((stdcall))
#define __THISCALL__ __attribute__((thiscall))
#define __FASTCALL__ __attribute__((fastcall))
+#define __MSABI__ __attribute__((ms_abi))
#else
#define __UNUSED__
#define __STDCALL__ __stdcall
#endif
/* MinGW kludge. */
-#ifdef _WIN64
+#if defined(_WIN64) | defined(_WIN32)
#define PRIdLL "I64d"
#define PRIuLL "I64u"
#else
/* MSVC kludge. */
#if defined _MSC_VER
+#if !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS)
#define PRIuPTR "lu"
#define PRIu8 "u"
#define PRId8 "d"
#define PRIu64 "I64u"
#define PRId64 "I64d"
#endif
+#endif
#ifndef PRIuPTR
#define PRIuPTR "u"