summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2025-12-29 03:15:03 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2025-12-29 10:33:31 +0900
commitcb01b9023ec2007c03bddc992416c33f2c59a0e1 (patch)
tree66b6ed43b9861b754946d09c2ba6c1677a12db69 /include
parent9e78353c0f840bf4aa7cceb4d1676f4d090d0096 (diff)
rtypeddata.h: Add missing `RBIMPL_CAST`
In public headers, casts should be enclosed in `RBIMPL_CAST` for compilation in C++.
Diffstat (limited to 'include')
-rw-r--r--include/ruby/internal/core/rtypeddata.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/include/ruby/internal/core/rtypeddata.h b/include/ruby/internal/core/rtypeddata.h
index 7d7df6c01a..55b7d2b47d 100644
--- a/include/ruby/internal/core/rtypeddata.h
+++ b/include/ruby/internal/core/rtypeddata.h
@@ -476,7 +476,7 @@ RBIMPL_SYMBOL_EXPORT_END()
*/
#define TypedData_Make_Struct0(result, klass, type, size, data_type, sval) \
VALUE result = rb_data_typed_object_zalloc(klass, size, data_type); \
- (sval) = (type *)RTYPEDDATA_GET_DATA(result); \
+ (sval) = RBIMPL_CAST((type *)RTYPEDDATA_GET_DATA(result)); \
RBIMPL_CAST(/*suppress unused variable warnings*/(void)(sval))
/**
@@ -594,7 +594,7 @@ RBIMPL_ATTR_ARTIFICIAL()
* @return Data type struct that corresponds to `obj`.
* @pre `obj` must be an instance of ::RTypedData.
*/
-static inline const struct rb_data_type_struct *
+static inline const rb_data_type_t *
RTYPEDDATA_TYPE(VALUE obj)
{
#if RUBY_DEBUG
@@ -604,7 +604,8 @@ RTYPEDDATA_TYPE(VALUE obj)
}
#endif
- return (const struct rb_data_type_struct *)(RTYPEDDATA(obj)->type & TYPED_DATA_PTR_MASK);
+ VALUE type = RTYPEDDATA(obj)->type & TYPED_DATA_PTR_MASK;
+ return RBIMPL_CAST((const rb_data_type_t *)type);
}
RBIMPL_ATTR_ARTIFICIAL()