summaryrefslogtreecommitdiff
path: root/gc.c
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2021-09-27 14:47:52 +0900
committerGitHub <noreply@github.com>2021-09-27 14:47:52 +0900
commitf7ffe9dbdeb2bebb4c9155fc391f0bab198bfb51 (patch)
tree24e273a2d906f2c40279f80eef46cbc6a36133fa /gc.c
parent582602d142c7ea2b21cd7539c09976b078d7bbe9 (diff)
Introduce `RBIMPL_NONNULL_ARG` macro
Runtime assertion for the argument declared as non-null. This macro does nothing if `RBIMPL_ATTR_NONNULL` is effective, otherwise asserts that the argument is non-null.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/4898 Merged-By: nobu <nobu@ruby-lang.org>
Diffstat (limited to 'gc.c')
-rw-r--r--gc.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/gc.c b/gc.c
index 40c035fcd2..cdee81dd05 100644
--- a/gc.c
+++ b/gc.c
@@ -2767,21 +2767,14 @@ rb_data_object_zalloc(VALUE klass, size_t size, RUBY_DATA_FUNC dmark, RUBY_DATA_
return obj;
}
-COMPILER_WARNING_PUSH
-#if __has_warning("-Wnonnull-compare") || GCC_VERSION_SINCE(6, 1, 0)
-COMPILER_WARNING_IGNORED(-Wnonnull-compare)
-#endif
-
VALUE
rb_data_typed_object_wrap(VALUE klass, void *datap, const rb_data_type_t *type)
{
- RUBY_ASSERT_ALWAYS(type);
+ RBIMPL_NONNULL_ARG(type);
if (klass) rb_data_object_check(klass);
return newobj_of(klass, T_DATA, (VALUE)type, (VALUE)1, (VALUE)datap, type->flags & RUBY_FL_WB_PROTECTED, sizeof(RVALUE));
}
-COMPILER_WARNING_POP
-
VALUE
rb_data_typed_object_zalloc(VALUE klass, size_t size, const rb_data_type_t *type)
{