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

ruby-changes:56560

From: Nobuyoshi <ko1@a...>
Date: Mon, 15 Jul 2019 17:48:39 +0900 (JST)
Subject: [ruby-changes:56560] Nobuyoshi Nakada: b452c03a14 (master): Always evaluate the expression RUBY_ASSERT_MESG_WHEN just once

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

From b452c03a14f943ae25338547bd680fce67399d85 Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Mon, 15 Jul 2019 17:45:37 +0900
Subject: Always evaluate the expression RUBY_ASSERT_MESG_WHEN just once


diff --git a/include/ruby/assert.h b/include/ruby/assert.h
index d19d8e4..bdc0234 100644
--- a/include/ruby/assert.h
+++ b/include/ruby/assert.h
@@ -23,7 +23,7 @@ NORETURN(void rb_assert_failure(const char *, int, const char *, const char *)); https://github.com/ruby/ruby/blob/trunk/include/ruby/assert.h#L23
     ((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), \
+        __builtin_choose_expr(cond, RUBY_ASSERT_MESG(expr, mesg), (void)(expr)), \
         RUBY_ASSERT_MESG(!(cond) || (expr), mesg)))
 #else
 # define RUBY_ASSERT_MESG_WHEN(cond, expr, mesg) \
-- 
cgit v0.10.2


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

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