[前][次][番号順一覧][スレッド一覧]

ruby-changes:56537

From: Nobuyoshi <ko1@a...>
Date: Mon, 15 Jul 2019 11:02:40 +0900 (JST)
Subject: [ruby-changes:56537] Nobuyoshi Nakada: a7fdb22373 (master): Enable RUBY_ASSERT_MESG_WHEN when RUBY_DEBUG is turned on

https://git.ruby-lang.org/ruby.git/commit/?id=a7fdb22373

From a7fdb22373442bb25e687a8f2df36fb5b85d2846 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Mon, 15 Jul 2019 11:00:16 +0900
Subject: Enable RUBY_ASSERT_MESG_WHEN when RUBY_DEBUG is turned on


diff --git a/include/ruby/assert.h b/include/ruby/assert.h
index a5ee396..d19d8e4 100644
--- a/include/ruby/assert.h
+++ b/include/ruby/assert.h
@@ -20,15 +20,16 @@ NORETURN(void rb_assert_failure(const char *, int, const char *, const char *)); https://github.com/ruby/ruby/blob/trunk/include/ruby/assert.h#L20
     ((expr) ? (void)0 : RUBY_ASSERT_FAIL(mesg))
 #ifdef HAVE_BUILTIN___BUILTIN_CHOOSE_EXPR_CONSTANT_P
 # define RUBY_ASSERT_MESG_WHEN(cond, expr, mesg) \
+    ((RUBY_DEBUG+0) ? RUBY_ASSERT_MESG((expr), mesg) : \
     __builtin_choose_expr( \
         __builtin_constant_p(cond), \
         __builtin_choose_expr(cond, RUBY_ASSERT_MESG(expr, mesg), (void)0), \
-        RUBY_ASSERT_MESG(!(cond) || (expr), mesg))
+        RUBY_ASSERT_MESG(!(cond) || (expr), mesg)))
 #else
 # define RUBY_ASSERT_MESG_WHEN(cond, expr, mesg) \
-    RUBY_ASSERT_MESG(!(cond) || (expr), mesg)
+    RUBY_ASSERT_MESG(!((RUBY_DEBUG+0) || (cond)) || (expr), mesg)
 #endif
-#define RUBY_ASSERT(expr) RUBY_ASSERT_MESG_WHEN(RUBY_DEBUG+(!RUBY_NDEBUG+0), expr, #expr)
+#define RUBY_ASSERT(expr) RUBY_ASSERT_MESG_WHEN((!RUBY_NDEBUG+0), expr, #expr)
 #define RUBY_ASSERT_WHEN(cond, expr) RUBY_ASSERT_MESG_WHEN(cond, expr, #expr)
 #define RUBY_ASSERT_ALWAYS(expr) RUBY_ASSERT_MESG_WHEN(TRUE, expr, #expr)
 
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]