use __typeof__
instead of typeof
and __func__
instead of __ASSERT_FUNC
for compatibility with other compilers and standard libraries (__ASSERT_FUNC seems to be a cygwin thing)
This commit is contained in:
parent
e20003c073
commit
24e7e0418f
|
@ -13,6 +13,6 @@ void xtest_internal_assert(const char* file, int line, const char* func, const c
|
||||||
#undef assert
|
#undef assert
|
||||||
|
|
||||||
#define assert(__e) ((__e) ? (void)0 : xtest_internal_assert(__FILE__, __LINE__, \
|
#define assert(__e) ((__e) ? (void)0 : xtest_internal_assert(__FILE__, __LINE__, \
|
||||||
__ASSERT_FUNC, #__e))
|
__func__, #__e))
|
||||||
|
|
||||||
#endif //defined(XTEST) && !defined(XTEST_XTEST_H)
|
#endif //defined(XTEST) && !defined(XTEST_XTEST_H)
|
||||||
|
|
6
xtest.h
6
xtest.h
|
@ -104,7 +104,7 @@ int xtest_complete();
|
||||||
|
|
||||||
|
|
||||||
#define force_types_equal(a, b) (void) _Generic(a, \
|
#define force_types_equal(a, b) (void) _Generic(a, \
|
||||||
typeof(b): (void*)0 \
|
__typeof__(b): (void*)0 \
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -112,8 +112,8 @@ int xtest_complete();
|
||||||
force_types_equal(expected, actual); \
|
force_types_equal(expected, actual); \
|
||||||
int _xtest_res = (expr); \
|
int _xtest_res = (expr); \
|
||||||
if (!(_xtest_res)) { \
|
if (!(_xtest_res)) { \
|
||||||
typeof(actual) _xtest_a = actual; \
|
__typeof__(actual) _xtest_a = actual; \
|
||||||
typeof(expected) _xtest_e = expected; \
|
__typeof__(expected) _xtest_e = expected; \
|
||||||
enum xtest_type _xtest_type = xtest_get_type(actual); \
|
enum xtest_type _xtest_type = xtest_get_type(actual); \
|
||||||
xtest_fail_assert(s, __FILE__, __LINE__, &_xtest_e, &_xtest_a, invert, _xtest_type); \
|
xtest_fail_assert(s, __FILE__, __LINE__, &_xtest_e, &_xtest_a, invert, _xtest_type); \
|
||||||
} \
|
} \
|
||||||
|
|
Loading…
Reference in a new issue