1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

respect RUBY_DEBUG.

see RUBY_DEBUG for each debug options.
This commit is contained in:
Koichi Sasada 2019-07-15 11:27:38 +09:00
parent d02f2fc3e2
commit c23e597674
3 changed files with 8 additions and 5 deletions

4
hash.c
View file

@ -394,9 +394,10 @@ ar_empty_entry(ar_table_entry *entry)
#define RHASH_TYPE(hash) (RHASH_AR_TABLE_P(hash) ? &objhash : RHASH_ST_TABLE(hash)->type) #define RHASH_TYPE(hash) (RHASH_AR_TABLE_P(hash) ? &objhash : RHASH_ST_TABLE(hash)->type)
#define RHASH_AR_TABLE_REF(hash, n) (&RHASH_AR_TABLE(hash)->entries[n]) #define RHASH_AR_TABLE_REF(hash, n) (&RHASH_AR_TABLE(hash)->entries[n])
#define HASH_ASSERT(expr) RUBY_ASSERT_MESG_WHEN(1, expr, #expr)
#if HASH_DEBUG #if HASH_DEBUG
#define hash_verify(hash) hash_verify_(hash, __FILE__, __LINE__) #define hash_verify(hash) hash_verify_(hash, __FILE__, __LINE__)
#define HASH_ASSERT(expr) RUBY_ASSERT_MESG_WHEN(1, expr, #expr)
void void
rb_hash_dump(VALUE hash) rb_hash_dump(VALUE hash)
@ -471,7 +472,6 @@ hash_verify_(VALUE hash, const char *file, int line)
#else #else
#define hash_verify(h) ((void)0) #define hash_verify(h) ((void)0)
#define HASH_ASSERT(e) ((void)0)
#endif #endif
static inline int static inline int

View file

@ -1302,7 +1302,7 @@ VALUE rb_gvar_defined(struct rb_global_entry *);
/* array.c */ /* array.c */
#ifndef ARRAY_DEBUG #ifndef ARRAY_DEBUG
#define ARRAY_DEBUG 0 #define ARRAY_DEBUG (0+RUBY_DEBUG)
#endif #endif
#ifdef ARRAY_DEBUG #ifdef ARRAY_DEBUG

View file

@ -17,7 +17,11 @@
* 1: enable local assertions. * 1: enable local assertions.
*/ */
#ifndef VM_CHECK_MODE #ifndef VM_CHECK_MODE
#define VM_CHECK_MODE 0
// respect RUBY_DUBUG: if given n is 0, then use RUBY_DEBUG
#define N_OR_RUBY_DEBUG(n) (((n) > 0) ? (n) : RUBY_DEBUG)
#define VM_CHECK_MODE N_OR_RUBY_DEBUG(0)
#endif #endif
/** /**
@ -46,7 +50,6 @@
#if VM_CHECK_MODE > 0 #if VM_CHECK_MODE > 0
#define VM_ASSERT(expr) RUBY_ASSERT_MESG_WHEN(VM_CHECK_MODE > 0, expr, #expr) #define VM_ASSERT(expr) RUBY_ASSERT_MESG_WHEN(VM_CHECK_MODE > 0, expr, #expr)
#define VM_UNREACHABLE(func) rb_bug(#func ": unreachable") #define VM_UNREACHABLE(func) rb_bug(#func ": unreachable")
#else #else