Ruby 3.4.5p51 (2025-07-16 revision 20cda200d3ce092571d0b5d342dadca69636cb0f)
|
#include "ruby/internal/assume.h"
#include "ruby/internal/attr/cold.h"
#include "ruby/internal/attr/format.h"
#include "ruby/internal/attr/noreturn.h"
#include "ruby/internal/cast.h"
#include "ruby/internal/dllexport.h"
#include "ruby/backward/2/assume.h"
Go to the source code of this file.
Macros | |
#define | RUBY_DEBUG 0 |
Define this macro when you want assertions. | |
#define | NDEBUG |
Define this macro when you don't want assertions. | |
#define | RUBY_NDEBUG 1 |
This macro is basically the same as NDEBUG. | |
#define | RBIMPL_VA_OPT_ARGS(...) |
Prints the given message, and terminates the entire process abnormally. | |
#define | RUBY_ASSERT_FAIL(mesg, ...) |
#define | RUBY_ASSERT_MESG(expr, ...) |
Asserts that the expression is truthy. | |
#define | RUBY_ASSERT_ALWAYS(expr, ...) |
A variant of RUBY_ASSERT that does not interface with RUBY_DEBUG. | |
#define | RUBY_ASSERT(...) |
Asserts that the given expression is truthy if and only if RUBY_DEBUG is truthy. | |
#define | RUBY_ASSERT_NDEBUG(...) |
A variant of RUBY_ASSERT that interfaces with NDEBUG instead of RUBY_DEBUG. | |
#define | RUBY_ASSERT_MESG_WHEN(cond, expr, ...) |
A variant of RUBY_ASSERT that asserts when either RUBY_DEBUG or cond parameter is truthy. | |
#define | RUBY_ASSERT_WHEN(cond, expr, ...) |
A variant of RUBY_ASSERT that asserts when either RUBY_DEBUG or cond parameter is truthy. | |
#define | RUBY_ASSERT_BUILTIN_TYPE(obj, type) |
A variant of RUBY_ASSERT that asserts when either RUBY_DEBUG or built-in type of obj is type. | |
#define | RBIMPL_ASSERT_OR_ASSUME(...) |
This is either RUBY_ASSERT or RBIMPL_ASSUME, depending on RUBY_DEBUG. |
Definition in file assert.h.
#define NDEBUG |
#define RBIMPL_ASSERT_OR_ASSUME | ( | ... | ) |
This is either RUBY_ASSERT or RBIMPL_ASSUME, depending on RUBY_DEBUG.
expr | What supposedly evaluates to true. |
Definition at line 311 of file assert.h.
Referenced by RARRAY_EMBED_LEN(), RB_BUILTIN_TYPE(), rb_fd_max(), RB_FIX2INT(), RB_FIX2UINT(), rb_fix2ulong(), RB_FL_REVERSE_RAW(), RB_FL_SET_RAW(), RB_FL_TEST_RAW(), RB_FL_UNSET_RAW(), RB_INT2FIX(), RB_OBJ_PROMOTED_RAW(), rb_rand_if(), RB_ST2FIX(), RBASIC_CLASS(), and ruby_scan_digits().
#define RBIMPL_VA_OPT_ARGS | ( | ... | ) |
#define RUBY_ASSERT | ( | ... | ) |
Asserts that the given expression is truthy if and only if RUBY_DEBUG is truthy.
expr | What supposedly evaluates to true. |
Definition at line 219 of file assert.h.
Referenced by rb_absint_numwords(), rb_ary_freeze(), rb_ary_replace(), rb_ary_sort_bang(), rb_class_superclass(), rb_fiber_scheduler_close(), rb_fiber_scheduler_get(), rb_fiber_scheduler_set(), rb_fiber_scheduler_unblock(), rb_include_module(), rb_obj_is_kind_of(), rb_prepend_module(), rb_str_hash(), and rb_str_update().
#define RUBY_ASSERT_ALWAYS | ( | expr, | |
... ) |
A variant of RUBY_ASSERT that does not interface with RUBY_DEBUG.
expr | What supposedly evaluates to true. |
Definition at line 199 of file assert.h.
Referenced by rb_data_object_wrap(), rb_memerror(), and rb_thread_call_with_gvl().
#define RUBY_ASSERT_BUILTIN_TYPE | ( | obj, | |
type ) |
A variant of RUBY_ASSERT that asserts when either RUBY_DEBUG or built-in type of obj is type.
obj | Object to check its built-in typue. |
type | Built-in type constant, T_ARRAY, T_STRING, etc. |
Definition at line 291 of file assert.h.
Referenced by rb_sym2str().
#define RUBY_ASSERT_FAIL | ( | mesg, | |
... ) |
#define RUBY_ASSERT_MESG | ( | expr, | |
... ) |
#define RUBY_ASSERT_MESG_WHEN | ( | cond, | |
expr, | |||
... ) |
A variant of RUBY_ASSERT that asserts when either RUBY_DEBUG or cond parameter is truthy.
cond | Extra condition that shall hold for assertion to take effect. |
expr | What supposedly evaluates to true. |
mesg | The message to display on failure. |
#define RUBY_ASSERT_NDEBUG | ( | ... | ) |
A variant of RUBY_ASSERT that interfaces with NDEBUG instead of RUBY_DEBUG.
This almost resembles assert C standard macro, except minor implementation details.
expr | What supposedly evaluates to true. |
#define RUBY_ASSERT_WHEN | ( | cond, | |
expr, | |||
... ) |
A variant of RUBY_ASSERT that asserts when either RUBY_DEBUG or cond parameter is truthy.
cond | Extra condition that shall hold for assertion to take effect. |
expr | What supposedly evaluates to true. |
#define RUBY_DEBUG 0 |
Define this macro when you want assertions.
Definition at line 88 of file assert.h.
Referenced by RSTRING_END(), and RSTRING_PTR().