diff --git a/include/criterion/assert.h b/include/criterion/assert.h index 4a5b2b4..4a1f7b1 100644 --- a/include/criterion/assert.h +++ b/include/criterion/assert.h @@ -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_ */