Ruby 3.3.5p100 (2024-09-03 revision ef084cc8f4958c1b6e4ead99136631bef6d8ddba)
|
#include "ruby/internal/assume.h"
#include "ruby/internal/attr/cold.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 | RUBY_ASSERT_FAIL(mesg) |
Prints the given message, and terminates the entire process abnormally. | |
#define | RUBY_ASSERT_MESG(expr, mesg) |
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(expr) |
Asserts that the given expression is truthy if and only if RUBY_DEBUG is truthy. | |
#define | RUBY_ASSERT_NDEBUG(expr) |
A variant of RUBY_ASSERT that interfaces with NDEBUG instead of RUBY_DEBUG. | |
#define | RUBY_ASSERT_MESG_WHEN(cond, expr, mesg) |
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 | RBIMPL_ASSERT_OR_ASSUME(expr) |
This is either RUBY_ASSERT or RBIMPL_ASSUME, depending on RUBY_DEBUG. | |
RBIMPL
or rbimpl
are implementation details. Don't take them as canon. They could rapidly appear then vanish. The name (path) of this header file is also an implementation detail. Do not expect it to persist at the place it is now. Developers are free to move it anywhere anytime at will. __VA_ARGS__
is always available. We assume C99 for ruby itself but we don't assume languages of extension libraries. They could be written in C++98. Definition in file assert.h.
#define NDEBUG |
#define RBIMPL_ASSERT_OR_ASSUME | ( | expr | ) |
This is either RUBY_ASSERT or RBIMPL_ASSUME, depending on RUBY_DEBUG.
expr | What supposedly evaluates to true. |
Definition at line 229 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 RUBY_ASSERT | ( | expr | ) |
Asserts that the given expression is truthy if and only if RUBY_DEBUG is truthy.
expr | What supposedly evaluates to true. |
Definition at line 177 of file assert.h.
Referenced by rb_class_superclass(), rb_include_module(), rb_obj_is_kind_of(), and rb_prepend_module().
#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 167 of file assert.h.
Referenced by rb_data_object_wrap(), and rb_thread_call_with_gvl().
#define RUBY_ASSERT_FAIL | ( | mesg | ) |
Prints the given message, and terminates the entire process abnormally.
mesg | The message to display. |
Definition at line 150 of file assert.h.
Referenced by rb_class_of().
#define RUBY_ASSERT_MESG | ( | expr, | |
mesg ) |
Asserts that the expression is truthy.
If not aborts with the message.
expr | What supposedly evaluates to true. |
mesg | The message to display on failure. |
#define RUBY_ASSERT_MESG_WHEN | ( | cond, | |
expr, | |||
mesg ) |
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 | ( | expr | ) |
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 87 of file assert.h.
Referenced by RSTRING_END(), and RSTRING_PTR().