From f0fd30552864c6556427c8d3fd444380b6456d60 Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 11 Jun 2015 02:35:46 +0000 Subject: vm_core.h: make VM_ASSERT an expression * vm_core.h (VM_ASSERT): make an expression, as well as standard assert(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50825 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- vm_core.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'vm_core.h') diff --git a/vm_core.h b/vm_core.h index e1e3fb1e59..55ed676afe 100644 --- a/vm_core.h +++ b/vm_core.h @@ -21,11 +21,11 @@ #endif #if VM_CHECK_MODE > 0 -#define VM_ASSERT(expr) do { \ - if(!(expr)) rb_bug("%s:%d assertion violation - %s", __FILE__, __LINE__, #expr); \ -} while (0) +#define VM_ASSERT(expr) ( \ + LIKELY(expr) ? (void)0 : \ + rb_bug("%s:%d assertion violation - %s", __FILE__, __LINE__, #expr)) #else -#define VM_ASSERT(expr) +#define VM_ASSERT(expr) ((void)0) #endif #define RUBY_VM_THREAD_MODEL 2 -- cgit v1.2.3