1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* suppress warnings.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27944 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2010-05-21 09:10:23 +00:00
parent c6b6293bc1
commit 87af442f94
11 changed files with 37 additions and 35 deletions

View file

@ -27,7 +27,6 @@ const union {
enum {
RUBY_ENCODING_INLINE_MAX = ENCODING_INLINE_MAX,
RUBY_ENCODING_SHIFT = ENCODING_SHIFT,
RUBY_ENCODING_MASK = ENCODING_MASK,
RUBY_ENC_CODERANGE_MASK = ENC_CODERANGE_MASK,
RUBY_ENC_CODERANGE_UNKNOWN = ENC_CODERANGE_UNKNOWN,
RUBY_ENC_CODERANGE_7BIT = ENC_CODERANGE_7BIT,
@ -70,6 +69,7 @@ const union {
const VALUE RUBY_FL_USER19 = FL_USER19;
const SIGNED_VALUE RUBY_NODE_LMASK = NODE_LMASK;
const VALUE RUBY_ENCODING_MASK = ENCODING_MASK;
int
ruby_debug_print_indent(int level, int debug_level, int indent_level)

2
dln.c
View file

@ -1316,7 +1316,7 @@ dln_load(const char *file)
goto failed;
}
init_fct = (void(*)())dlsym(handle, buf);
init_fct = (void(*)())(VALUE)dlsym(handle, buf);
#if defined __SYMBIAN32__
if (init_fct == NULL) {
init_fct = (void(*)())dlsym(handle, "1"); /* Some Symbian versions do not support symbol table in DLL, ordinal numbers only */

View file

@ -82,7 +82,7 @@ rb_dlcfunc_new(void (*func)(), int type, const char *name, ID calltype)
rb_secure(4);
if( func ){
val = TypedData_Make_Struct(rb_cDLCFunc, struct cfunc_data, &dlcfunc_data_type, data);
data->ptr = func;
data->ptr = (void *)(VALUE)func;
data->name = name ? strdup(name) : NULL;
data->type = type;
data->calltype = calltype;
@ -306,9 +306,11 @@ rb_dlcfunc_inspect(VALUE self)
}
# define DECL_FUNC_CDECL(f,ret,args) ret (FUNC_CDECL(*f))(args)
# define DECL_FUNC_CDECL(f,ret,args,val) \
ret (FUNC_CDECL(*f))(args) = (ret (FUNC_CDECL(*))(args))(VALUE)(val)
#ifdef FUNC_STDCALL
# define DECL_FUNC_STDCALL(f,ret,args) ret (FUNC_STDCALL(*f))(args)
# define DECL_FUNC_STDCALL(f,ret,args,val) \
ret (FUNC_STDCALL(*f))(args) = (ret (FUNC_STDCALL(*))(args))(VALUE)(val)
#endif
#define CALL_CASE switch( RARRAY_LEN(ary) ){ \
@ -376,7 +378,7 @@ rb_dlcfunc_call(VALUE self, VALUE ary)
switch( cfunc->type ){
case DLTYPE_VOID:
#define CASE(n) case n: { \
DECL_FUNC_CDECL(f,void,DLSTACK_PROTO##n) = cfunc->ptr; \
DECL_FUNC_CDECL(f,void,DLSTACK_PROTO##n,cfunc->ptr); \
f(DLSTACK_ARGS##n(stack)); \
result = Qnil; \
}
@ -385,7 +387,7 @@ rb_dlcfunc_call(VALUE self, VALUE ary)
break;
case DLTYPE_VOIDP:
#define CASE(n) case n: { \
DECL_FUNC_CDECL(f,void*,DLSTACK_PROTO##n) = cfunc->ptr; \
DECL_FUNC_CDECL(f,void*,DLSTACK_PROTO##n,cfunc->ptr); \
void * ret; \
ret = f(DLSTACK_ARGS##n(stack)); \
result = PTR2NUM(ret); \
@ -395,7 +397,7 @@ rb_dlcfunc_call(VALUE self, VALUE ary)
break;
case DLTYPE_CHAR:
#define CASE(n) case n: { \
DECL_FUNC_CDECL(f,char,DLSTACK_PROTO##n) = cfunc->ptr; \
DECL_FUNC_CDECL(f,char,DLSTACK_PROTO##n,cfunc->ptr); \
char ret; \
ret = f(DLSTACK_ARGS##n(stack)); \
result = CHR2FIX(ret); \
@ -405,7 +407,7 @@ rb_dlcfunc_call(VALUE self, VALUE ary)
break;
case DLTYPE_SHORT:
#define CASE(n) case n: { \
DECL_FUNC_CDECL(f,short,DLSTACK_PROTO##n) = cfunc->ptr; \
DECL_FUNC_CDECL(f,short,DLSTACK_PROTO##n,cfunc->ptr); \
short ret; \
ret = f(DLSTACK_ARGS##n(stack)); \
result = INT2NUM((int)ret); \
@ -415,7 +417,7 @@ rb_dlcfunc_call(VALUE self, VALUE ary)
break;
case DLTYPE_INT:
#define CASE(n) case n: { \
DECL_FUNC_CDECL(f,int,DLSTACK_PROTO##n) = cfunc->ptr; \
DECL_FUNC_CDECL(f,int,DLSTACK_PROTO##n,cfunc->ptr); \
int ret; \
ret = f(DLSTACK_ARGS##n(stack)); \
result = INT2NUM(ret); \
@ -425,7 +427,7 @@ rb_dlcfunc_call(VALUE self, VALUE ary)
break;
case DLTYPE_LONG:
#define CASE(n) case n: { \
DECL_FUNC_CDECL(f,long,DLSTACK_PROTO##n) = cfunc->ptr; \
DECL_FUNC_CDECL(f,long,DLSTACK_PROTO##n,cfunc->ptr); \
long ret; \
ret = f(DLSTACK_ARGS##n(stack)); \
result = LONG2NUM(ret); \
@ -436,7 +438,7 @@ rb_dlcfunc_call(VALUE self, VALUE ary)
#if HAVE_LONG_LONG /* used in ruby.h */
case DLTYPE_LONG_LONG:
#define CASE(n) case n: { \
DECL_FUNC_CDECL(f,LONG_LONG,DLSTACK_PROTO##n) = cfunc->ptr; \
DECL_FUNC_CDECL(f,LONG_LONG,DLSTACK_PROTO##n,cfunc->ptr); \
LONG_LONG ret; \
ret = f(DLSTACK_ARGS##n(stack)); \
result = LL2NUM(ret); \
@ -447,7 +449,7 @@ rb_dlcfunc_call(VALUE self, VALUE ary)
#endif
case DLTYPE_FLOAT:
#define CASE(n) case n: { \
DECL_FUNC_CDECL(f,float,DLSTACK_PROTO##n) = cfunc->ptr; \
DECL_FUNC_CDECL(f,float,DLSTACK_PROTO##n,cfunc->ptr); \
float ret; \
ret = f(DLSTACK_ARGS##n(stack)); \
result = rb_float_new(ret); \
@ -457,7 +459,7 @@ rb_dlcfunc_call(VALUE self, VALUE ary)
break;
case DLTYPE_DOUBLE:
#define CASE(n) case n: { \
DECL_FUNC_CDECL(f,double,DLSTACK_PROTO##n) = cfunc->ptr; \
DECL_FUNC_CDECL(f,double,DLSTACK_PROTO##n,cfunc->ptr); \
double ret; \
ret = f(DLSTACK_ARGS##n(stack)); \
result = rb_float_new(ret); \
@ -475,7 +477,7 @@ rb_dlcfunc_call(VALUE self, VALUE ary)
switch( cfunc->type ){
case DLTYPE_VOID:
#define CASE(n) case n: { \
DECL_FUNC_STDCALL(f,void,DLSTACK_PROTO##n##_) = cfunc->ptr; \
DECL_FUNC_STDCALL(f,void,DLSTACK_PROTO##n##_,cfunc->ptr); \
f(DLSTACK_ARGS##n(stack)); \
result = Qnil; \
}
@ -484,7 +486,7 @@ rb_dlcfunc_call(VALUE self, VALUE ary)
break;
case DLTYPE_VOIDP:
#define CASE(n) case n: { \
DECL_FUNC_STDCALL(f,void*,DLSTACK_PROTO##n##_) = cfunc->ptr; \
DECL_FUNC_STDCALL(f,void*,DLSTACK_PROTO##n##_,cfunc->ptr); \
void * ret; \
ret = f(DLSTACK_ARGS##n(stack)); \
result = PTR2NUM(ret); \
@ -494,7 +496,7 @@ rb_dlcfunc_call(VALUE self, VALUE ary)
break;
case DLTYPE_CHAR:
#define CASE(n) case n: { \
DECL_FUNC_STDCALL(f,char,DLSTACK_PROTO##n##_) = cfunc->ptr; \
DECL_FUNC_STDCALL(f,char,DLSTACK_PROTO##n##_,cfunc->ptr); \
char ret; \
ret = f(DLSTACK_ARGS##n(stack)); \
result = CHR2FIX(ret); \
@ -504,7 +506,7 @@ rb_dlcfunc_call(VALUE self, VALUE ary)
break;
case DLTYPE_SHORT:
#define CASE(n) case n: { \
DECL_FUNC_STDCALL(f,short,DLSTACK_PROTO##n##_) = cfunc->ptr; \
DECL_FUNC_STDCALL(f,short,DLSTACK_PROTO##n##_,cfunc->ptr); \
short ret; \
ret = f(DLSTACK_ARGS##n(stack)); \
result = INT2NUM((int)ret); \
@ -514,7 +516,7 @@ rb_dlcfunc_call(VALUE self, VALUE ary)
break;
case DLTYPE_INT:
#define CASE(n) case n: { \
DECL_FUNC_STDCALL(f,int,DLSTACK_PROTO##n##_) = cfunc->ptr; \
DECL_FUNC_STDCALL(f,int,DLSTACK_PROTO##n##_,cfunc->ptr); \
int ret; \
ret = f(DLSTACK_ARGS##n(stack)); \
result = INT2NUM(ret); \
@ -524,7 +526,7 @@ rb_dlcfunc_call(VALUE self, VALUE ary)
break;
case DLTYPE_LONG:
#define CASE(n) case n: { \
DECL_FUNC_STDCALL(f,long,DLSTACK_PROTO##n##_) = cfunc->ptr; \
DECL_FUNC_STDCALL(f,long,DLSTACK_PROTO##n##_,cfunc->ptr); \
long ret; \
ret = f(DLSTACK_ARGS##n(stack)); \
result = LONG2NUM(ret); \
@ -535,7 +537,7 @@ rb_dlcfunc_call(VALUE self, VALUE ary)
#if HAVE_LONG_LONG /* used in ruby.h */
case DLTYPE_LONG_LONG:
#define CASE(n) case n: { \
DECL_FUNC_STDCALL(f,LONG_LONG,DLSTACK_PROTO##n##_) = cfunc->ptr; \
DECL_FUNC_STDCALL(f,LONG_LONG,DLSTACK_PROTO##n##_,cfunc->ptr); \
LONG_LONG ret; \
ret = f(DLSTACK_ARGS##n(stack)); \
result = LL2NUM(ret); \
@ -546,7 +548,7 @@ rb_dlcfunc_call(VALUE self, VALUE ary)
#endif
case DLTYPE_FLOAT:
#define CASE(n) case n: { \
DECL_FUNC_STDCALL(f,float,DLSTACK_PROTO##n##_) = cfunc->ptr; \
DECL_FUNC_STDCALL(f,float,DLSTACK_PROTO##n##_,cfunc->ptr); \
float ret; \
ret = f(DLSTACK_ARGS##n(stack)); \
result = rb_float_new(ret); \
@ -556,7 +558,7 @@ rb_dlcfunc_call(VALUE self, VALUE ary)
break;
case DLTYPE_DOUBLE:
#define CASE(n) case n: { \
DECL_FUNC_STDCALL(f,double,DLSTACK_PROTO##n##_) = cfunc->ptr; \
DECL_FUNC_STDCALL(f,double,DLSTACK_PROTO##n##_,cfunc->ptr); \
double ret; \
ret = f(DLSTACK_ARGS##n(stack)); \
result = rb_float_new(ret); \

View file

@ -16,9 +16,9 @@ get_freefunc(VALUE func)
return NULL;
}
if (rb_dlcfunc_kind_p(func)) {
return RCFUNC_DATA(func)->ptr;
return (freefunc_t)(VALUE)RCFUNC_DATA(func)->ptr;
}
return NUM2PTR(rb_Integer(func));
return (freefunc_t)(VALUE)NUM2PTR(rb_Integer(func));
}
static ID id_to_ptr;

View file

@ -305,7 +305,7 @@ dlhandle_sym(void *handle, const char *name)
void (*func)();
rb_secure(2);
func = dlsym(handle, name);
func = (void (*)())(VALUE)dlsym(handle, name);
CHECK_DLERROR;
#if defined(FUNC_STDCALL)
if( !func ){

View file

@ -16,7 +16,7 @@
# include <unistd.h> /* for read(), and write() */
#endif
#define numberof(ary) (sizeof(ary)/sizeof(ary[0]))
#define numberof(ary) (int)(sizeof(ary)/sizeof(ary[0]))
#ifdef _WIN32
# define TO_SOCKET(s) _get_osfhandle(s)
@ -103,7 +103,7 @@ struct {
const char *name;
SSL_METHOD *(*func)(void);
} ossl_ssl_method_tab[] = {
#define OSSL_SSL_METHOD_ENTRY(name) { #name, name##_method }
#define OSSL_SSL_METHOD_ENTRY(name) { #name, (SSL_METHOD *(*)(void))name##_method }
OSSL_SSL_METHOD_ENTRY(TLSv1),
OSSL_SSL_METHOD_ENTRY(TLSv1_server),
OSSL_SSL_METHOD_ENTRY(TLSv1_client),
@ -1428,7 +1428,7 @@ ossl_ssl_get_cipher(VALUE self)
rb_warning("SSL session is not started yet.");
return Qnil;
}
cipher = SSL_get_current_cipher(ssl);
cipher = (SSL_CIPHER *)SSL_get_current_cipher(ssl);
return ossl_ssl_cipher_to_ary(cipher);
}

View file

@ -262,8 +262,7 @@ ancillary_unix_rights(VALUE self)
if (level != SOL_SOCKET || type != SCM_RIGHTS)
rb_raise(rb_eTypeError, "SCM_RIGHTS ancillary data expected");
VALUE v = rb_attr_get(self, rb_intern("unix_rights"));
return v;
return rb_attr_get(self, rb_intern("unix_rights"));
}
#else
#define ancillary_unix_rights rb_f_notimplement

View file

@ -472,9 +472,9 @@ static VALUE
unix_s_socketpair(int argc, VALUE *argv, VALUE klass)
{
VALUE domain, type, protocol;
domain = INT2FIX(PF_UNIX);
VALUE args[3];
domain = INT2FIX(PF_UNIX);
rb_scan_args(argc, argv, "02", &type, &protocol);
if (argc == 0)
type = INT2FIX(SOCK_STREAM);

View file

@ -82,6 +82,7 @@ typedef enum {
YAMLBYTE_E_WRITE = 'W', /* output stream write error */
YAMLBYTE_E_OTHER = '?', /* some other error condition */
YAMLBYTE_E_PARSE = 'P', /* parse error, check bytecodes */
YAMLBYTE_MAX
} yamlbyte_result_t;
typedef const yamlbyte_char_t *yamlbyte_buff_t;

4
gc.c
View file

@ -1808,7 +1808,7 @@ finalize_list(rb_objspace_t *objspace, RVALUE *p)
add_freelist(objspace, p);
}
else {
struct heaps_slot *slot = (struct heaps_slot *)RDATA(p)->dmark;
struct heaps_slot *slot = (struct heaps_slot *)(VALUE)RDATA(p)->dmark;
slot->limit--;
}
p = tmp;
@ -1908,7 +1908,7 @@ gc_sweep(rb_objspace_t *objspace)
RVALUE *pp;
for (pp = final_list; pp != final; pp = pp->as.free.next) {
RDATA(pp)->dmark = (void *)&heaps[i];
RDATA(pp)->dmark = (void (*)())(VALUE)&heaps[i];
pp->as.free.flags |= FL_SINGLETON; /* freeing page mark */
}
heaps[i].limit = final_num;

2
ruby.c
View file

@ -369,7 +369,7 @@ ruby_init_loadpath_safe(int safe_level)
_execname(libpath, sizeof(libpath) - 1);
#elif defined(HAVE_DLADDR)
Dl_info dli;
if (dladdr(expand_include_path, &dli)) {
if (dladdr((void *)(VALUE)expand_include_path, &dli)) {
VALUE rb_realpath_internal(VALUE basedir, VALUE path, int strict);
char fbuf[MAXPATHLEN];
char *f = dln_find_file_r(dli.dli_fname, getenv(PATH_ENV), fbuf, sizeof(fbuf));