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
This commit is contained in:
nobu 2015-06-11 02:35:46 +00:00
parent a3b89d7493
commit f0fd305528

View File

@ -21,11 +21,11 @@
#endif #endif
#if VM_CHECK_MODE > 0 #if VM_CHECK_MODE > 0
#define VM_ASSERT(expr) do { \ #define VM_ASSERT(expr) ( \
if(!(expr)) rb_bug("%s:%d assertion violation - %s", __FILE__, __LINE__, #expr); \ LIKELY(expr) ? (void)0 : \
} while (0) rb_bug("%s:%d assertion violation - %s", __FILE__, __LINE__, #expr))
#else #else
#define VM_ASSERT(expr) #define VM_ASSERT(expr) ((void)0)
#endif #endif
#define RUBY_VM_THREAD_MODEL 2 #define RUBY_VM_THREAD_MODEL 2