mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Use RUBY_DEBUG instead of NDEBUG
Assertions in header files slows down an interpreter, so they should be turned off by default (simple `make`). To enable them, define a macro `RUBY_DEBUG=1` (e.g. `make cppflags=-DRUBY_DEBUG` or use `#define` at the very beggining of the file. Note that even if `NDEBUG=1` is defined, `RUBY_DEBUG=1` enables all assertions. [Feature #16837] related: https://github.com/ruby/ruby/pull/3120 `assert()` lines in MRI *.c is not disabled even if `RUBY_DEBUG=0` and it can be disabled with `NDEBUG=1`. So please consider to use `RUBY_ASSERT()` if you want to disable them when `RUBY_DEBUG=0`.
This commit is contained in:
parent
b10b37924a
commit
21991e6ca5
Notes:
git
2020-05-26 03:21:52 +09:00
19 changed files with 82 additions and 82 deletions
|
@ -112,7 +112,7 @@ void rb_ary_detransient(VALUE a);
|
|||
#endif
|
||||
RBIMPL_SYMBOL_EXPORT_END()
|
||||
|
||||
RBIMPL_ATTR_PURE_ON_NDEBUG()
|
||||
RBIMPL_ATTR_PURE_UNLESS_DEBUG()
|
||||
RBIMPL_ATTR_ARTIFICIAL()
|
||||
static inline long
|
||||
RARRAY_EMBED_LEN(VALUE ary)
|
||||
|
@ -126,7 +126,7 @@ RARRAY_EMBED_LEN(VALUE ary)
|
|||
return RBIMPL_CAST((long)f);
|
||||
}
|
||||
|
||||
RBIMPL_ATTR_PURE_ON_NDEBUG()
|
||||
RBIMPL_ATTR_PURE_UNLESS_DEBUG()
|
||||
static inline long
|
||||
rb_array_len(VALUE a)
|
||||
{
|
||||
|
@ -147,7 +147,7 @@ RARRAY_LENINT(VALUE ary)
|
|||
return rb_long2int(RARRAY_LEN(ary));
|
||||
}
|
||||
|
||||
RBIMPL_ATTR_PURE_ON_NDEBUG()
|
||||
RBIMPL_ATTR_PURE_UNLESS_DEBUG()
|
||||
RBIMPL_ATTR_ARTIFICIAL()
|
||||
static inline bool
|
||||
RARRAY_TRANSIENT_P(VALUE ary)
|
||||
|
@ -161,7 +161,7 @@ RARRAY_TRANSIENT_P(VALUE ary)
|
|||
#endif
|
||||
}
|
||||
|
||||
RBIMPL_ATTR_PURE_ON_NDEBUG()
|
||||
RBIMPL_ATTR_PURE_UNLESS_DEBUG()
|
||||
/* internal function. do not use this function */
|
||||
static inline const VALUE *
|
||||
rb_array_const_ptr_transient(VALUE a)
|
||||
|
@ -177,7 +177,7 @@ rb_array_const_ptr_transient(VALUE a)
|
|||
}
|
||||
|
||||
#if ! USE_TRANSIENT_HEAP
|
||||
RBIMPL_ATTR_PURE_ON_NDEBUG()
|
||||
RBIMPL_ATTR_PURE_UNLESS_DEBUG()
|
||||
#endif
|
||||
/* internal function. do not use this function */
|
||||
static inline const VALUE *
|
||||
|
@ -258,7 +258,7 @@ RARRAY_ASET(VALUE ary, long i, VALUE v)
|
|||
|
||||
/* RARRAY_AREF is used as a lvalue. Cannot be a function. */
|
||||
#if 0
|
||||
RBIMPL_ATTR_PURE_ON_NDEBUG()
|
||||
RBIMPL_ATTR_PURE_UNLESS_DEBUG()
|
||||
RBIMPL_ATTR_ARTIFICIAL()
|
||||
static inline VALUE
|
||||
RARRAY_AREF(VALUE ary, long i)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue