summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-05-21 09:10:23 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-05-21 09:10:23 +0000
commit87af442f946da3b5ab3bc8fb351824ec8c240fe7 (patch)
tree792f75b9f15c0da49ecf99a8512ccd5581f59733
parentc6b6293bc13b9107cad52f407810cddc4dd0b475 (diff)
* suppress warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27944 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--debug.c2
-rw-r--r--dln.c2
-rw-r--r--ext/dl/cfunc.c44
-rw-r--r--ext/dl/cptr.c4
-rw-r--r--ext/dl/handle.c2
-rw-r--r--ext/openssl/ossl_ssl.c6
-rw-r--r--ext/socket/ancdata.c3
-rw-r--r--ext/socket/unixsocket.c2
-rw-r--r--ext/syck/yamlbyte.h1
-rw-r--r--gc.c4
-rw-r--r--ruby.c2
11 files changed, 37 insertions, 35 deletions
diff --git a/debug.c b/debug.c
index d86a0656e19..02fa9292a2b 100644
--- a/debug.c
+++ b/debug.c
@@ -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)
diff --git a/dln.c b/dln.c
index 8d2b62eba20..e9bfff2e888 100644
--- a/dln.c
+++ b/dln.c
@@ -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 */
diff --git a/ext/dl/cfunc.c b/ext/dl/cfunc.c
index f2579da191d..b123b50d242 100644
--- a/ext/dl/cfunc.c
+++ b/ext/dl/cfunc.c
@@ -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); \
diff --git a/ext/dl/cptr.c b/ext/dl/cptr.c
index 5edd13cc972..2a34a704e2f 100644
--- a/ext/dl/cptr.c
+++ b/ext/dl/cptr.c
@@ -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;
diff --git a/ext/dl/handle.c b/ext/dl/handle.c
index dddd8d54e97..3e3b91a8c99 100644
--- a/ext/dl/handle.c
+++ b/ext/dl/handle.c
@@ -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 ){
diff --git a/ext/openssl/ossl_ssl.c b/ext/openssl/ossl_ssl.c
index c17d0ab839c..5c958f0ac31 100644
--- a/ext/openssl/ossl_ssl.c
+++ b/ext/openssl/ossl_ssl.c
@@ -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);
}
diff --git a/ext/socket/ancdata.c b/ext/socket/ancdata.c
index 880f79cf176..b58e03c7129 100644
--- a/ext/socket/ancdata.c
+++ b/ext/socket/ancdata.c
@@ -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
diff --git a/ext/socket/unixsocket.c b/ext/socket/unixsocket.c
index 6bdaa94620c..82893abcfe4 100644
--- a/ext/socket/unixsocket.c
+++ b/ext/socket/unixsocket.c
@@ -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);
diff --git a/ext/syck/yamlbyte.h b/ext/syck/yamlbyte.h
index a12a36d79b7..16ca3d70de3 100644
--- a/ext/syck/yamlbyte.h
+++ b/ext/syck/yamlbyte.h
@@ -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;
diff --git a/gc.c b/gc.c
index 762a533c7f5..43f28100f4a 100644
--- a/gc.c
+++ b/gc.c
@@ -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;
diff --git a/ruby.c b/ruby.c
index fadb7cc0fe4..0e87a146c7d 100644
--- a/ruby.c
+++ b/ruby.c
@@ -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));