6 #if defined(__cplusplus) 14 #ifdef RUBY_FUNCTION_NAME_STRING 15 # define RUBY_ASSERT_FAIL(expr) \ 16 rb_assert_failure(__FILE__, __LINE__, RUBY_FUNCTION_NAME_STRING, expr) 18 # define RUBY_ASSERT_FAIL(expr) \ 19 rb_assert_failure(__FILE__, __LINE__, NULL, expr) 21 #define RUBY_ASSERT_MESG(expr, mesg) \ 22 ((expr) ? (void)0 : RUBY_ASSERT_FAIL(mesg)) 23 #ifdef HAVE_BUILTIN___BUILTIN_CHOOSE_EXPR_CONSTANT_P 24 # define RUBY_ASSERT_MESG_WHEN(cond, expr, mesg) \ 25 __builtin_choose_expr( \ 26 __builtin_constant_p(cond), \ 27 __builtin_choose_expr(cond, RUBY_ASSERT_MESG(expr, mesg), (void)0), \ 28 RUBY_ASSERT_MESG(!(cond) || (expr), mesg)) 30 # define RUBY_ASSERT_MESG_WHEN(cond, expr, mesg) \ 31 RUBY_ASSERT_MESG(!(cond) || (expr), mesg) 33 #define RUBY_ASSERT(expr) RUBY_ASSERT_MESG_WHEN(!RUBY_NDEBUG+0, expr, #expr) 34 #define RUBY_ASSERT_WHEN(cond, expr) RUBY_ASSERT_MESG_WHEN(cond, expr, #expr) 37 #define assert RUBY_ASSERT 41 # define RUBY_NDEBUG 1 43 # define RUBY_NDEBUG 0 47 #if defined(__cplusplus) NORETURN(void rb_assert_failure(const char *, int, const char *, const char *))
void rb_assert_failure(const char *file, int line, const char *name, const char *expr)