Added macro alias for assert and enhanced compatibility with assert.h

This commit is contained in:
Snaipe 2015-04-24 00:32:20 +02:00
parent 6b71e1c319
commit b8d44f433a

View file

@ -72,7 +72,13 @@ struct criterion_assert_args {
.msg = (Message) \
)
# ifdef assert
# undef assert
# pragma message("The assert macro has been replaced by criterion.")
# endif
# define assert(...) assert_(__VA_ARGS__, .sentinel_ = 0)
# define criterion_assert(...) assert_(__VA_ARGS__, .sentinel_ = 0)
# define expect(...) expect_(__VA_ARGS__, .sentinel_ = 0)
# define assert_(Condition, ...) assert_impl(FATAL, Condition, __VA_ARGS__)
@ -267,4 +273,8 @@ struct criterion_assert_args {
expect_arrays_eq_cmp_(__VA_ARGS__, .sentinel_ = 0)
# endif /* !__GNUC__ */
// this is needed to make the POSIX assert.h redefine assert if
// subsequently included
# define _ASSERT_H 1
#endif /* !CRITERION_ASSERT_H_ */