From a45ec733343edc37a9226ee9d5e7387322cfd996 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Sat, 15 Feb 2014 04:34:11 +0000 Subject: [PATCH] ID is always uint32_t --- ext/dl/cfunc.c | 2 +- include/ruby/ruby.h | 5 ++--- iseq.c | 3 ++- marshal.c | 3 ++- vm_method.c | 6 +++--- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/ext/dl/cfunc.c b/ext/dl/cfunc.c index 1f4958b..f52ba2d 100644 --- a/ext/dl/cfunc.c +++ b/ext/dl/cfunc.c @@ -590,7 +590,7 @@ rb_dlcfunc_call(VALUE self, VALUE ary) } else{ rb_raise(rb_eDLError, "unsupported call type: %"PRIxVALUE, - cfunc->calltype); + (VALUE)cfunc->calltype); } } diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h index abd4b4b..7734ddc 100644 --- a/include/ruby/ruby.h +++ b/include/ruby/ruby.h @@ -80,19 +80,16 @@ void *alloca(); #if defined HAVE_UINTPTR_T && 0 typedef uintptr_t VALUE; -typedef uintptr_t ID; # define SIGNED_VALUE intptr_t # define SIZEOF_VALUE SIZEOF_UINTPTR_T # undef PRI_VALUE_PREFIX #elif SIZEOF_LONG == SIZEOF_VOIDP typedef unsigned long VALUE; -typedef unsigned long ID; # define SIGNED_VALUE long # define SIZEOF_VALUE SIZEOF_LONG # define PRI_VALUE_PREFIX "l" #elif SIZEOF_LONG_LONG == SIZEOF_VOIDP typedef unsigned LONG_LONG VALUE; -typedef unsigned LONG_LONG ID; # define SIGNED_VALUE LONG_LONG # define LONG_LONG_VALUE 1 # define SIZEOF_VALUE SIZEOF_LONG_LONG @@ -101,6 +98,8 @@ typedef unsigned LONG_LONG ID; # error ---->> ruby requires sizeof(void*) == sizeof(long) or sizeof(LONG_LONG) to be compiled. <<---- #endif +typedef uint32_t ID; + typedef char ruby_check_sizeof_int[SIZEOF_INT == sizeof(int) ? 1 : -1]; typedef char ruby_check_sizeof_long[SIZEOF_LONG == sizeof(long) ? 1 : -1]; #ifdef HAVE_LONG_LONG diff --git a/iseq.c b/iseq.c index 3b0c10b..3a2f634 100644 --- a/iseq.c +++ b/iseq.c @@ -547,7 +547,8 @@ iseq_load(VALUE self, VALUE data, VALUE parent, VALUE opt) if (typename) rb_raise(rb_eTypeError, "unsupport type: :%"PRIsVALUE, typename); else - rb_raise(rb_eTypeError, "unsupport type: %p", (void *)typeid); + rb_raise(rb_eTypeError, "unsupport type: %p", + (void *)(VALUE)typeid); } if (parent == Qnil) { diff --git a/marshal.c b/marshal.c index 7772b4c..50772b0 100644 --- a/marshal.c +++ b/marshal.c @@ -420,7 +420,8 @@ w_symbol(ID id, struct dump_arg *arg) else { sym = rb_id2str(id); if (!sym) { - rb_raise(rb_eTypeError, "can't dump anonymous ID %"PRIdVALUE, id); + rb_raise(rb_eTypeError, "can't dump anonymous ID %"PRIdVALUE, + (VALUE)id); } encname = encoding_name(sym, arg); if (NIL_P(encname) || diff --git a/vm_method.c b/vm_method.c index 203b8b8..4648db9 100644 --- a/vm_method.c +++ b/vm_method.c @@ -467,7 +467,7 @@ rb_add_method(VALUE klass, ID mid, rb_method_type_t type, void *opts, rb_method_ break; case VM_METHOD_TYPE_ATTRSET: case VM_METHOD_TYPE_IVAR: - def->body.attr.id = (ID)opts; + def->body.attr.id = *(ID *)opts; RB_OBJ_WRITE(klass, &def->body.attr.location, Qfalse); th = GET_THREAD(); cfp = rb_vm_get_ruby_level_next_cfp(th, th->cfp); @@ -896,10 +896,10 @@ rb_attr(VALUE klass, ID id, int read, int write, int ex) } attriv = rb_intern_str(rb_sprintf("@%"PRIsVALUE, aname)); if (read) { - rb_add_method(klass, id, VM_METHOD_TYPE_IVAR, (void *)attriv, noex); + rb_add_method(klass, id, VM_METHOD_TYPE_IVAR, &attriv, noex); } if (write) { - rb_add_method(klass, rb_id_attrset(id), VM_METHOD_TYPE_ATTRSET, (void *)attriv, noex); + rb_add_method(klass, rb_id_attrset(id), VM_METHOD_TYPE_ATTRSET, &attriv, noex); } } -- 1.9.rc2