summaryrefslogtreecommitdiff
path: root/ext
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 /ext
parentc6b6293bc13b9107cad52f407810cddc4dd0b475 (diff)
* suppress warnings.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27944 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-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
7 files changed, 32 insertions, 30 deletions
diff --git a/ext/dl/cfunc.c b/ext/dl/cfunc.c
index f2579da191..b123b50d24 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 5edd13cc97..2a34a704e2 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 dddd8d54e9..3e3b91a8c9 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 c17d0ab839..5c958f0ac3 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 880f79cf17..b58e03c712 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 6bdaa94620..82893abcfe 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 a12a36d79b..16ca3d70de 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;