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:
Gwendolyn 2022-01-03 15:20:44 +01:00
parent e20003c073
commit 24e7e0418f
2 changed files with 4 additions and 4 deletions

View file

@ -13,6 +13,6 @@ void xtest_internal_assert(const char* file, int line, const char* func, const c
#undef assert
#define assert(__e) ((__e) ? (void)0 : xtest_internal_assert(__FILE__, __LINE__, \
__ASSERT_FUNC, #__e))
__func__, #__e))
#endif //defined(XTEST) && !defined(XTEST_XTEST_H)

View file

@ -104,7 +104,7 @@ int xtest_complete();
#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); \
int _xtest_res = (expr); \
if (!(_xtest_res)) { \
typeof(actual) _xtest_a = actual; \
typeof(expected) _xtest_e = expected; \
__typeof__(actual) _xtest_a = actual; \
__typeof__(expected) _xtest_e = expected; \
enum xtest_type _xtest_type = xtest_get_type(actual); \
xtest_fail_assert(s, __FILE__, __LINE__, &_xtest_e, &_xtest_a, invert, _xtest_type); \
} \