1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/ruby_assert.h
Koichi Sasada 63160a84b4 respect NDEBUG.
ruby/ruby.h includes ruby/assert.h, and RUBY_NDEBUG is defined
by checking NDEBUG. In other words, NDEBUG is only seen just
after ruby/ruby.h. This patch also cheks NDEBUG just after
including ruby_assert.h.

Without this patch, assertions in array.c are always enabled.
2019-07-19 12:04:32 +09:00

15 lines
350 B
C

#include "ruby/assert.h"
#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L)
/* C89 compilers are required to support strings of only 509 chars. */
/* can't use RUBY_ASSERT for such compilers. */
#include <assert.h>
#else
#undef assert
#define assert RUBY_ASSERT
#endif
#ifdef NDEBUG
#undef RUBY_NDEBUG
#define RUBY_NDEBUG 1
#endif