From 21991e6ca59274e41a472b5256bd3245f6596c90 Mon Sep 17 00:00:00 2001 From: Koichi Sasada Date: Wed, 20 May 2020 11:38:44 +0900 Subject: 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`. --- include/ruby/internal/core/rbasic.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/ruby/internal/core/rbasic.h') diff --git a/include/ruby/internal/core/rbasic.h b/include/ruby/internal/core/rbasic.h index 76333fd78e..2b578b663c 100644 --- a/include/ruby/internal/core/rbasic.h +++ b/include/ruby/internal/core/rbasic.h @@ -73,7 +73,7 @@ VALUE rb_obj_hide(VALUE obj); VALUE rb_obj_reveal(VALUE obj, VALUE klass); /* do not use this API to change klass information */ RBIMPL_SYMBOL_EXPORT_END() -RBIMPL_ATTR_PURE_ON_NDEBUG() +RBIMPL_ATTR_PURE_UNLESS_DEBUG() RBIMPL_ATTR_ARTIFICIAL() static inline VALUE RBASIC_CLASS(VALUE obj) -- cgit v1.2.3