Commit 70653c2b authored by Florent's avatar Florent
Browse files

fix clang define __gnuc__

1 merge request!237Add convenient assert macro
Showing with 6 additions and 1 deletion
......@@ -178,10 +178,15 @@ BCTBX_PUBLIC int bc_assert_va(const char *file, int line, int predicate, const c
bc_assert(__FILE__, __LINE__, pred, format); \
} while (0)
// Test if __VA_OPT__ is defined
#define PP_THIRD_ARG(a, b, c, ...) c
#define VA_OPT_SUPPORTED_I(...) PP_THIRD_ARG(__VA_OPT__(, ), true, false, )
#define VA_OPT_SUPPORTED VA_OPT_SUPPORTED_I(?)
#define BC_PASS(msg) bc_assert(__FILE__, __LINE__, TRUE, "BC_PASS(" #msg ").")
#define BC_FAIL(msg) bc_assert(__FILE__, __LINE__, FALSE, "BC_FAIL(" #msg ").")
#define BC_ASSERT(value) bc_assert(__FILE__, __LINE__, (value), #value)
#ifdef __GNUC__ // __VA_OPT__ only in gnu c or c++20
#if VA_OPT_SUPPORTED // __VA_OPT__ only in gnu c or c++20
#define BC_ASSERT_MSG(value, msg, ...) bc_assert_va(__FILE__, __LINE__, (value), msg __VA_OPT__(, ) __VA_ARGS__)
#else
#define BC_ASSERT_MSG(value, msg, ...) bc_assert(__FILE__, __LINE__, (value), msg)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment