From cb01b9023ec2007c03bddc992416c33f2c59a0e1 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Mon, 29 Dec 2025 03:15:03 +0900 Subject: rtypeddata.h: Add missing `RBIMPL_CAST` In public headers, casts should be enclosed in `RBIMPL_CAST` for compilation in C++. --- include/ruby/internal/core/rtypeddata.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'include/ruby/internal') 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() -- cgit v1.2.3