summaryrefslogtreecommitdiff
path: root/vm_core.h
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-06-11 02:35:46 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-06-11 02:35:46 (GMT)
commitf0fd30552864c6556427c8d3fd444380b6456d60 (patch)
treeff4f30e8404e5c6e5dd8fa539c1e5de757984366 /vm_core.h
parenta3b89d7493d25925a80dc874723cf53fdb0d9c69 (diff)
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
Diffstat (limited to 'vm_core.h')
-rw-r--r--vm_core.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/vm_core.h b/vm_core.h
index e1e3fb1..55ed676 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