logo       


Choosing A Webhost:
A web hosting service is a type of Internet hosting service that allows individuals and organizations to provide their own website accessible via the World Wide Web. Web hosts are companies that provide space on a server they own for use by their clients as well as providing Internet connectivity, typically in a data center. Web hosts can also provide data center space and connectivity to the Internet for servers they do not own to be located in their data center, called colocation. more...

[ruby-dev:27302] warning: 'cdecl' attribute directive ignored: msg#00368

Subject: [ruby-dev:27302] warning: 'cdecl' attribute directive ignored
西山和広です。

Mac OS Xでmakeすると

cfunc.c:280: warning: 'cdecl' attribute directive ignored
cfunc.c:439: warning: 'stdcall' attribute directive ignored

というwarningが大量にでますが、以下のようなパッチでどうでしょうか?

gsub!(/\bDECL_FUNC\(([^,]+,[^,]+,[^,]+),\s*stdcall\)/) { 
"DECL_FUNC_STDCALL(#$1)" }
gsub!(/\bDECL_FUNC\(([^,]+,[^,]+,[^,]+),\s*cdecl\)/) { "DECL_FUNC_CDECL(#$1)" }
でマクロ呼び出しを置き換えて、マクロ定義部分を適当に
書き換えてみた状態です。


ruby 1.9.0 (2005-09-22) [i686-linux]で
ext/dl/test/のtest_all.rbが
32 tests, 71 assertions, 0 failures, 0 errors
になって通るのは確認しています。

このテストは他のテストと同じようにtestの下に移動した方が
良いのではないでしょうか?


Index: cfunc.c
===================================================================
RCS file: /src/ruby/ext/dl/cfunc.c,v
retrieving revision 1.4
diff -u -p -r1.4 cfunc.c
--- cfunc.c     4 Mar 2005 06:47:39 -0000       1.4
+++ cfunc.c     22 Sep 2005 20:29:38 -0000
@@ -223,10 +223,12 @@ rb_dlcfunc_inspect(VALUE self)
 }
 
 #if defined(__GNUC__)
-# define DECL_FUNC(f,ret,args,calltype)  ret (__attribute__((calltype)) 
*f)(args)
+# define DECL_FUNC_CDECL(f,ret,args)  ret (*FUNC_CDECL(f))(args)
+# define DECL_FUNC_STDCALL(f,ret,args)  ret (*FUNC_STDCALL(f))(args)
 /* # define DECL_FUNC(f,ret,args,calltype)  ret (*f)(args) */
 #elif defined(_MSC_VER) || defined(__BORLANDC__)
-# define DECL_FUNC(f,ret,args,calltype)  ret (__##calltype *f)(args)
+# define DECL_FUNC_CDECL(f,ret,args)  ret (__cdecl *f)(args)
+# define DECL_FUNC_STDCALL(f,ret,args)  ret (__stdcall *f)(args)
 #else
 # error "unsupported compiler."
 #endif
@@ -273,7 +275,7 @@ rb_dlcfunc_call(VALUE self, VALUE ary)
        switch( cfunc->type ){
        case DLTYPE_VOID:
 #define CASE(n) case n: { \
-            DECL_FUNC(f,void,DLSTACK_PROTO##n,cdecl) = cfunc->ptr; \
+            DECL_FUNC_CDECL(f,void,DLSTACK_PROTO##n) = cfunc->ptr; \
            f(DLSTACK_ARGS##n(stack)); \
            result = Qnil; \
 }
@@ -282,7 +284,7 @@ rb_dlcfunc_call(VALUE self, VALUE ary)
            break;
        case DLTYPE_VOIDP:
 #define CASE(n) case n: { \
-           DECL_FUNC(f,void*,DLSTACK_PROTO##n,cdecl) = cfunc->ptr; \
+           DECL_FUNC_CDECL(f,void*,DLSTACK_PROTO##n) = cfunc->ptr; \
            void * ret; \
            ret = f(DLSTACK_ARGS##n(stack)); \
            result = PTR2NUM(ret); \
@@ -292,7 +294,7 @@ rb_dlcfunc_call(VALUE self, VALUE ary)
            break;
        case DLTYPE_CHAR:
 #define CASE(n) case n: { \
-           DECL_FUNC(f,char,DLSTACK_PROTO##n,cdecl) = cfunc->ptr; \
+           DECL_FUNC_CDECL(f,char,DLSTACK_PROTO##n) = cfunc->ptr; \
            char ret; \
            ret = f(DLSTACK_ARGS##n(stack)); \
            result = CHR2FIX(ret); \
@@ -302,7 +304,7 @@ rb_dlcfunc_call(VALUE self, VALUE ary)
            break;
        case DLTYPE_SHORT:
 #define CASE(n) case n: { \
-           DECL_FUNC(f,short,DLSTACK_PROTO##n,cdecl) = cfunc->ptr; \
+           DECL_FUNC_CDECL(f,short,DLSTACK_PROTO##n) = cfunc->ptr; \
            short ret; \
            ret = f(DLSTACK_ARGS##n(stack)); \
            result = INT2NUM((int)ret); \
@@ -312,7 +314,7 @@ rb_dlcfunc_call(VALUE self, VALUE ary)
            break;
        case DLTYPE_INT:
 #define CASE(n) case n: { \
-           DECL_FUNC(f,int,DLSTACK_PROTO##n,cdecl) = cfunc->ptr; \
+           DECL_FUNC_CDECL(f,int,DLSTACK_PROTO##n) = cfunc->ptr; \
            int ret; \
            ret = f(DLSTACK_ARGS##n(stack)); \
            result = INT2NUM(ret); \
@@ -322,7 +324,7 @@ rb_dlcfunc_call(VALUE self, VALUE ary)
            break;
        case DLTYPE_LONG:
 #define CASE(n) case n: { \
-           DECL_FUNC(f,long,DLSTACK_PROTO##n,cdecl) = cfunc->ptr; \
+           DECL_FUNC_CDECL(f,long,DLSTACK_PROTO##n) = cfunc->ptr; \
            long ret; \
            ret = f(DLSTACK_ARGS##n(stack)); \
            result = LONG2NUM(ret); \
@@ -333,7 +335,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(f,LONG_LONG,DLSTACK_PROTO,cdecl) = cfunc->ptr; \
+           DECL_FUNC_CDECL(f,LONG_LONG,DLSTACK_PROTO) = cfunc->ptr; \
            LONG_LONG ret; \
            ret = f(DLSTACK_ARGS(stack)); \
            result = LL2NUM(ret); \
@@ -344,7 +346,7 @@ rb_dlcfunc_call(VALUE self, VALUE ary)
 #endif
        case DLTYPE_FLOAT:
 #define CASE(n) case n: { \
-           DECL_FUNC(f,float,DLSTACK_PROTO,cdecl) = cfunc->ptr; \
+           DECL_FUNC_CDECL(f,float,DLSTACK_PROTO) = cfunc->ptr; \
            float ret; \
            ret = f(DLSTACK_ARGS(stack)); \
            result = rb_float_new(ret); \
@@ -354,7 +356,7 @@ rb_dlcfunc_call(VALUE self, VALUE ary)
            break;
        case DLTYPE_DOUBLE:
 #define CASE(n) case n: { \
-           DECL_FUNC(f,double,DLSTACK_PROTO,cdecl) = cfunc->ptr; \
+           DECL_FUNC_CDECL(f,double,DLSTACK_PROTO) = cfunc->ptr; \
            double ret; \
            ret = f(DLSTACK_ARGS(stack)); \
            result = rb_float_new(ret); \
@@ -371,7 +373,7 @@ rb_dlcfunc_call(VALUE self, VALUE ary)
        switch( cfunc->type ){
        case DLTYPE_VOID:
 #define CASE(n) case n: { \
-            DECL_FUNC(f,void,DLSTACK_PROTO##n,stdcall) = cfunc->ptr; \
+            DECL_FUNC_STDCALL(f,void,DLSTACK_PROTO##n) = cfunc->ptr; \
            f(DLSTACK_ARGS##n(stack)); \
            result = Qnil; \
 }
@@ -380,7 +382,7 @@ rb_dlcfunc_call(VALUE self, VALUE ary)
            break;
        case DLTYPE_VOIDP:
 #define CASE(n) case n: { \
-           DECL_FUNC(f,void*,DLSTACK_PROTO##n,stdcall) = cfunc->ptr; \
+           DECL_FUNC_STDCALL(f,void*,DLSTACK_PROTO##n) = cfunc->ptr; \
            void * ret; \
            ret = f(DLSTACK_ARGS##n(stack)); \
            result = PTR2NUM(ret); \
@@ -390,7 +392,7 @@ rb_dlcfunc_call(VALUE self, VALUE ary)
            break;
        case DLTYPE_CHAR:
 #define CASE(n) case n: { \
-           DECL_FUNC(f,char,DLSTACK_PROTO##n,stdcall) = cfunc->ptr; \
+           DECL_FUNC_STDCALL(f,char,DLSTACK_PROTO##n) = cfunc->ptr; \
            char ret; \
            ret = f(DLSTACK_ARGS##n(stack)); \
            result = CHR2FIX(ret); \
@@ -400,7 +402,7 @@ rb_dlcfunc_call(VALUE self, VALUE ary)
            break;
        case DLTYPE_SHORT:
 #define CASE(n) case n: { \
-           DECL_FUNC(f,short,DLSTACK_PROTO##n,stdcall) = cfunc->ptr; \
+           DECL_FUNC_STDCALL(f,short,DLSTACK_PROTO##n) = cfunc->ptr; \
            short ret; \
            ret = f(DLSTACK_ARGS##n(stack)); \
            result = INT2NUM((int)ret); \
@@ -410,7 +412,7 @@ rb_dlcfunc_call(VALUE self, VALUE ary)
            break;
        case DLTYPE_INT:
 #define CASE(n) case n: { \
-           DECL_FUNC(f,int,DLSTACK_PROTO##n,stdcall) = cfunc->ptr; \
+           DECL_FUNC_STDCALL(f,int,DLSTACK_PROTO##n) = cfunc->ptr; \
            int ret; \
            ret = f(DLSTACK_ARGS##n(stack)); \
            result = INT2NUM(ret); \
@@ -420,7 +422,7 @@ rb_dlcfunc_call(VALUE self, VALUE ary)
            break;
        case DLTYPE_LONG:
 #define CASE(n) case n: { \
-           DECL_FUNC(f,long,DLSTACK_PROTO##n,stdcall) = cfunc->ptr; \
+           DECL_FUNC_STDCALL(f,long,DLSTACK_PROTO##n) = cfunc->ptr; \
            long ret; \
            ret = f(DLSTACK_ARGS##n(stack)); \
            result = LONG2NUM(ret); \
@@ -431,7 +433,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(f,LONG_LONG,DLSTACK_PROTO,stdcall) = cfunc->ptr; \
+           DECL_FUNC_STDCALL(f,LONG_LONG,DLSTACK_PROTO) = cfunc->ptr; \
            LONG_LONG ret; \
            ret = f(DLSTACK_ARGS(stack)); \
            result = LL2NUM(ret); \
@@ -442,7 +444,7 @@ rb_dlcfunc_call(VALUE self, VALUE ary)
 #endif
        case DLTYPE_FLOAT:
 #define CASE(n) case n: { \
-           DECL_FUNC(f,float,DLSTACK_PROTO,stdcall) = cfunc->ptr; \
+           DECL_FUNC_STDCALL(f,float,DLSTACK_PROTO) = cfunc->ptr; \
            float ret; \
            ret = f(DLSTACK_ARGS(stack)); \
            result = rb_float_new(ret); \
@@ -452,7 +454,7 @@ rb_dlcfunc_call(VALUE self, VALUE ary)
            break;
        case DLTYPE_DOUBLE:
 #define CASE(n) case n: { \
-           DECL_FUNC(f,double,DLSTACK_PROTO,stdcall) = cfunc->ptr; \
+           DECL_FUNC_STDCALL(f,double,DLSTACK_PROTO) = cfunc->ptr; \
            double ret; \
            ret = f(DLSTACK_ARGS(stack)); \
            result = rb_float_new(ret); \



-- 
|ZnZ(ゼット エヌ ゼット)
|西山和広(Kazuhiro NISHIYAMA)




Ruby Jobs
Java Jobs
Jobs in California
more...
what
job title, keywords
where
city, state, zip
jobs by job search
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
db.firebase.por...    text.xml.xalan....    qnx.openqnx.dev...    user-groups.zar...    internationaliz...    kde.devel.konve...    finance.e-gold....    emacs.latex.pre...    gis.therion/200...    web.webmin.gene...    yellowdog.gener...    vserver/2003-08...    redhat.release....    sysutils.tivoli...    xfree86.expert/...    mail.becky.user...    hardware.netapp...    netbsd.ports.xe...    python.distutil...    boot-loaders.gr...    culture.interne...    java.springfram...    activedir/2006-...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe