diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2019-07-14 14:44:59 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2019-07-14 17:58:06 +0900 |
commit | 08c2a9dc599021668e11dee2f099a204122eab90 (patch) | |
tree | 67e5f7b69e2d2c1199cc9310d1d91e8c5854debd /include | |
parent | 715955ff27206351dcf509eb3c60e0927ad9a708 (diff) |
Introduce RUBY_DEBUG flag macro
When RUBY_DEBUG is turned on, all RUBY_ASSERT() macros will be
enabled regardless RUBY_NDEBUG.
Diffstat (limited to 'include')
-rw-r--r-- | include/ruby/assert.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/include/ruby/assert.h b/include/ruby/assert.h index aef36b8d48..f8930a7bba 100644 --- a/include/ruby/assert.h +++ b/include/ruby/assert.h @@ -28,9 +28,12 @@ NORETURN(void rb_assert_failure(const char *, int, const char *, const char *)); # define RUBY_ASSERT_MESG_WHEN(cond, expr, mesg) \ RUBY_ASSERT_MESG(!(cond) || (expr), mesg) #endif -#define RUBY_ASSERT(expr) RUBY_ASSERT_MESG_WHEN(!RUBY_NDEBUG+0, expr, #expr) +#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) +#ifndef RUBY_DEBUG +# define RUBY_DEBUG 0 +#endif #ifndef RUBY_NDEBUG # ifdef NDEBUG # define RUBY_NDEBUG 1 |