ruby-changes:38452
From: nobu <ko1@a...>
Date: Tue, 19 May 2015 09:44:16 +0900 (JST)
Subject: [ruby-changes:38452] nobu:r50533 (trunk): ruby.h: cast for C++
nobu 2015-05-19 09:43:58 +0900 (Tue, 19 May 2015) New Revision: 50533 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=50533 Log: ruby.h: cast for C++ * include/ruby/ruby.h (Data_Make_Struct0, TypedData_Make_Struct0): explicit cast from void* is necessary as implicit cast is disallowed in C++. Modified files: trunk/ChangeLog trunk/include/ruby/ruby.h Index: include/ruby/ruby.h =================================================================== --- include/ruby/ruby.h (revision 50532) +++ include/ruby/ruby.h (revision 50533) @@ -1031,13 +1031,13 @@ void *rb_check_typeddata(VALUE, const rb https://github.com/ruby/ruby/blob/trunk/include/ruby/ruby.h#L1031 #define Data_Wrap_Struct(klass,mark,free,sval)\ rb_data_object_wrap((klass),(sval),(RUBY_DATA_FUNC)(mark),(RUBY_DATA_FUNC)(free)) -#define Data_Make_Struct0(result, klass, size, mark, free, sval) \ +#define Data_Make_Struct0(result, klass, type, size, mark, free, sval) \ VALUE result = rb_data_object_zalloc(klass, size, mark, free); \ - (void)((sval) = DATA_PTR(result)); + (void)((sval) = (type *)DATA_PTR(result)); #ifdef __GNUC__ #define Data_Make_Struct(klass,type,mark,free,sval) ({\ - Data_Make_Struct0(data_struct_obj, klass, sizeof(type), mark, free, sval); \ + Data_Make_Struct0(data_struct_obj, klass, type, sizeof(type), mark, free, sval); \ data_struct_obj; \ }) #else @@ -1049,13 +1049,13 @@ void *rb_check_typeddata(VALUE, const rb https://github.com/ruby/ruby/blob/trunk/include/ruby/ruby.h#L1049 #define TypedData_Wrap_Struct(klass,data_type,sval)\ rb_data_typed_object_wrap((klass),(sval),(data_type)) -#define TypedData_Make_Struct0(result, klass, size, data_type, sval) \ +#define TypedData_Make_Struct0(result, klass, type, size, data_type, sval) \ VALUE result = rb_data_typed_object_zalloc(klass, size, data_type); \ - (void)((sval) = DATA_PTR(result)); + (void)((sval) = (type *)DATA_PTR(result)); #ifdef __GNUC__ #define TypedData_Make_Struct(klass, type, data_type, sval) ({\ - TypedData_Make_Struct0(data_struct_obj, klass, sizeof(type), data_type, sval); \ + TypedData_Make_Struct0(data_struct_obj, klass, type, sizeof(type), data_type, sval); \ data_struct_obj; \ }) #else @@ -1227,14 +1227,14 @@ rb_data_object_get_warning(VALUE obj) https://github.com/ruby/ruby/blob/trunk/include/ruby/ruby.h#L1227 static inline VALUE rb_data_object_make(VALUE klass, RUBY_DATA_FUNC mark_func, RUBY_DATA_FUNC free_func, void **datap, size_t size) { - Data_Make_Struct0(result, klass, size, mark_func, free_func, *datap); + Data_Make_Struct0(result, klass, void, size, mark_func, free_func, *datap); return result; } static inline VALUE rb_data_typed_object_make(VALUE klass, const rb_data_type_t *type, void **datap, size_t size) { - TypedData_Make_Struct0(result, klass, size, type, *datap); + TypedData_Make_Struct0(result, klass, void, size, type, *datap); return result; } Index: ChangeLog =================================================================== --- ChangeLog (revision 50532) +++ ChangeLog (revision 50533) @@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Tue May 19 09:43:56 2015 Nobuyoshi Nakada <nobu@r...> + + * include/ruby/ruby.h (Data_Make_Struct0, TypedData_Make_Struct0): + explicit cast from void* is necessary as implicit cast is + disallowed in C++. + Mon May 18 15:31:31 2015 Nobuyoshi Nakada <nobu@r...> * include/ruby/intern.h (rb_f_notimplement): should not respond to -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/