From 08c2a9dc599021668e11dee2f099a204122eab90 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Sun, 14 Jul 2019 14:44:59 +0900 Subject: Introduce RUBY_DEBUG flag macro When RUBY_DEBUG is turned on, all RUBY_ASSERT() macros will be enabled regardless RUBY_NDEBUG. --- include/ruby/assert.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'include/ruby') 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 -- cgit v1.2.3