introduce RUBY_ASSERT_ALWAYS(expr).
RUBY_ASSERT_ALWAYS(expr) ignores NDEBUG (we cannot remove this assertion).
This commit is contained in:
parent
0af897ab59
commit
f6f09cbc76
2
array.c
2
array.c
@ -1125,7 +1125,7 @@ ary_take_first_or_last(int argc, const VALUE *argv, VALUE ary, enum ary_take_pos
|
||||
/* the case optional argument is omitted should be handled in
|
||||
* callers of this function. if another arity case is added,
|
||||
* this arity check needs to rewrite. */
|
||||
RUBY_ASSERT_WHEN(TRUE, argc == 1);
|
||||
RUBY_ASSERT_ALWAYS(argc == 1);
|
||||
|
||||
n = NUM2LONG(argv[0]);
|
||||
len = RARRAY_LEN(ary);
|
||||
|
@ -30,6 +30,7 @@ NORETURN(void rb_assert_failure(const char *, int, const char *, const char *));
|
||||
#endif
|
||||
#define RUBY_ASSERT(expr) RUBY_ASSERT_MESG_WHEN(RUBY_DEBUG+(!RUBY_NDEBUG+0), expr, #expr)
|
||||
#define RUBY_ASSERT_WHEN(cond, expr) RUBY_ASSERT_MESG_WHEN(cond, expr, #expr)
|
||||
#define RUBY_ASSERT_ALWAYS(expr) RUBY_ASSERT_MESG_WHEN(TRUE, expr, #expr)
|
||||
|
||||
#ifndef RUBY_DEBUG
|
||||
# define RUBY_DEBUG 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user