summaryrefslogtreecommitdiff
path: root/include/ruby/internal/core/rregexp.h
diff options
context:
space:
mode:
authorKoichi Sasada <[email protected]>2020-05-20 11:38:44 +0900
committerKoichi Sasada <[email protected]>2020-05-26 03:21:14 +0900
commit21991e6ca59274e41a472b5256bd3245f6596c90 (patch)
treeb4cf1b0f059dc2a5b49abd44f4487224d38d0cb7 /include/ruby/internal/core/rregexp.h
parentb10b37924aef33426ea6e2fda5ce17804796ecc4 (diff)
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`.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3124
Diffstat (limited to 'include/ruby/internal/core/rregexp.h')
-rw-r--r--include/ruby/internal/core/rregexp.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/include/ruby/internal/core/rregexp.h b/include/ruby/internal/core/rregexp.h
index c6ece314b4..f289ee1dda 100644
--- a/include/ruby/internal/core/rregexp.h
+++ b/include/ruby/internal/core/rregexp.h
@@ -46,7 +46,7 @@ struct RRegexp {
unsigned long usecnt;
};
-RBIMPL_ATTR_PURE_ON_NDEBUG()
+RBIMPL_ATTR_PURE_UNLESS_DEBUG()
RBIMPL_ATTR_ARTIFICIAL()
static inline VALUE
RREGEXP_SRC(VALUE rexp)
@@ -57,7 +57,7 @@ RREGEXP_SRC(VALUE rexp)
return ret;
}
-RBIMPL_ATTR_PURE_ON_NDEBUG()
+RBIMPL_ATTR_PURE_UNLESS_DEBUG()
RBIMPL_ATTR_ARTIFICIAL()
static inline char *
RREGEXP_SRC_PTR(VALUE rexp)
@@ -65,7 +65,7 @@ RREGEXP_SRC_PTR(VALUE rexp)
return RSTRING_PTR(RREGEXP_SRC(rexp));
}
-RBIMPL_ATTR_PURE_ON_NDEBUG()
+RBIMPL_ATTR_PURE_UNLESS_DEBUG()
RBIMPL_ATTR_ARTIFICIAL()
static inline long
RREGEXP_SRC_LEN(VALUE rexp)
@@ -73,7 +73,7 @@ RREGEXP_SRC_LEN(VALUE rexp)
return RSTRING_LEN(RREGEXP_SRC(rexp));
}
-RBIMPL_ATTR_PURE_ON_NDEBUG()
+RBIMPL_ATTR_PURE_UNLESS_DEBUG()
RBIMPL_ATTR_ARTIFICIAL()
static inline char *
RREGEXP_SRC_END(VALUE rexp)