summaryrefslogtreecommitdiff
path: root/ruby_assert.h
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2019-07-14 13:05:16 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2019-07-14 17:45:21 +0900
commit32f013514460574eed03aa678f87ed7ca9600872 (patch)
treec40387e1b8d734107cc553b061dcc3ffd9ae9858 /ruby_assert.h
parent5786df12f5c07510f9f15e984c564179afae33c0 (diff)
Split RUBY_ASSERT and so on under include/ruby
Diffstat (limited to 'ruby_assert.h')
-rw-r--r--ruby_assert.h52
1 files changed, 1 insertions, 51 deletions
diff --git a/ruby_assert.h b/ruby_assert.h
index 185d2e5f5f..139256fed8 100644
--- a/ruby_assert.h
+++ b/ruby_assert.h
@@ -1,37 +1,4 @@
-#ifndef RUBY_ASSERT_H
-#define RUBY_ASSERT_H
-
-#include "ruby/ruby.h"
-
-#if defined(__cplusplus)
-extern "C" {
-#if 0
-} /* satisfy cc-mode */
-#endif
-#endif
-
-NORETURN(void rb_assert_failure(const char *, int, const char *, const char *));
-#ifdef RUBY_FUNCTION_NAME_STRING
-# define RUBY_ASSERT_FAIL(expr) \
- rb_assert_failure(__FILE__, __LINE__, RUBY_FUNCTION_NAME_STRING, expr)
-#else
-# define RUBY_ASSERT_FAIL(expr) \
- rb_assert_failure(__FILE__, __LINE__, NULL, expr)
-#endif
-#define RUBY_ASSERT_MESG(expr, mesg) \
- ((expr) ? (void)0 : RUBY_ASSERT_FAIL(mesg))
-#ifdef HAVE_BUILTIN___BUILTIN_CHOOSE_EXPR_CONSTANT_P
-# define RUBY_ASSERT_MESG_WHEN(cond, expr, mesg) \
- __builtin_choose_expr( \
- __builtin_constant_p(cond), \
- __builtin_choose_expr(cond, RUBY_ASSERT_MESG(expr, mesg), (void)0), \
- RUBY_ASSERT_MESG(!(cond) || (expr), mesg))
-#else
-# define RUBY_ASSERT_MESG_WHEN(cond, expr, mesg) \
- RUBY_ASSERT_MESG(!(cond) || (expr), mesg)
-#endif
-#define RUBY_ASSERT(expr) RUBY_ASSERT_MESG_WHEN(!RUBY_NDEBUG+0, expr, #expr)
-#define RUBY_ASSERT_WHEN(cond, expr) RUBY_ASSERT_MESG_WHEN(cond, expr, #expr)
+#include "ruby/assert.h"
#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L)
/* C89 compilers are required to support strings of only 509 chars. */
@@ -41,20 +8,3 @@ NORETURN(void rb_assert_failure(const char *, int, const char *, const char *));
#undef assert
#define assert RUBY_ASSERT
#endif
-
-#ifndef RUBY_NDEBUG
-# ifdef NDEBUG
-# define RUBY_NDEBUG 1
-# else
-# define RUBY_NDEBUG 0
-# endif
-#endif
-
-#if defined(__cplusplus)
-#if 0
-{ /* satisfy cc-mode */
-#endif
-} /* extern "C" { */
-#endif
-
-#endif