From: pegacorn Date: 2007-07-14T20:00:01+09:00 Subject: [ruby-dev:31222] trunk: バグを指摘している警告 trunk で -Wall を付けてコンパイルしてみると、バグを指摘している警告が いくつか見付かりました。 compiling digest gcc -I. -I../../.ext/include/i386-freebsd6.2 -I../.././include -I../.././ext/digest -DRUBY_EXTCONF_H=\"extconf.h\" -fPIC -g -O2 -Wall -c digest.c digest.c: In function `rb_digest_instance_update': digest.c:100: warning: format argument is not a pointer (arg 3) digest.c: In function `rb_digest_instance_finish': digest.c:118: warning: format argument is not a pointer (arg 3) digest.c: In function `rb_digest_instance_reset': digest.c:132: warning: format argument is not a pointer (arg 3) digest.c: In function `rb_digest_instance_block_length': digest.c:361: warning: format argument is not a pointer (arg 3) digest.c: In function `rb_digest_class_s_digest': compiling dl gcc -I. -I../../.ext/include/i386-freebsd6.2 -I../.././include -I../.././ext/dl -DRUBY_EXTCONF_H=\"extconf.h\" -fPIC -g -O2 -Wall -fno-defer-pop -fno-omit-frame-pointer -c cfunc.c cfunc.c: In function `rb_dlcfunc_call': cfunc.c:463: warning: unsigned int format, ID arg (arg 3) compiling openssl gcc -I. -I../../.ext/include/i386-freebsd6.2 -I../.././include -I../.././ext/openssl -DRUBY_EXTCONF_H=\"extconf.h\" -fPIC -g -O2 -Wall -c ossl_x509name.c ossl_x509name.c: In function `ossl_x509name_to_s': ossl_x509name.c:207: warning: null format string ossl_x509name.c:211: warning: null format string ext/openssl の ossl_x509name.c:207: warning: null format string ossl_x509name.c:211: warning: null format string は、 - rb_raise(eX509NameError, NULL); + rb_raise(eX509NameError, ""); にすべきかどうかよくわかりませんが、他を見ると ossl_raise() を使うつもり だったと思われたので、ossl_raise() に置き換えました。 Index: ext/digest/digest.c =================================================================== --- ext/digest/digest.c (リビジョン 12779) +++ ext/digest/digest.c (作業コピー) @@ -97,7 +97,7 @@ static VALUE rb_digest_instance_update(VALUE self, VALUE str) { - rb_raise(rb_eRuntimeError, "%s does not implement update()", rb_inspect(self)); + rb_raise(rb_eRuntimeError, "%s does not implement update()", RSTRING_PTR(rb_inspect(self))); } /* @@ -115,7 +115,7 @@ static VALUE rb_digest_instance_finish(VALUE self) { - rb_raise(rb_eRuntimeError, "%s does not implement finish()", rb_inspect(self)); + rb_raise(rb_eRuntimeError, "%s does not implement finish()", RSTRING_PTR(rb_inspect(self))); } /* @@ -129,7 +129,7 @@ static VALUE rb_digest_instance_reset(VALUE self) { - rb_raise(rb_eRuntimeError, "%s does not implement reset()", rb_inspect(self)); + rb_raise(rb_eRuntimeError, "%s does not implement reset()", RSTRING_PTR(rb_inspect(self))); } /* @@ -358,7 +358,7 @@ static VALUE rb_digest_instance_block_length(VALUE self) { - rb_raise(rb_eRuntimeError, "%s does not implement block_length()", rb_inspect(self)); + rb_raise(rb_eRuntimeError, "%s does not implement block_length()", RSTRING_PTR(rb_inspect(self))); } /* Index: ext/dl/cfunc.c =================================================================== --- ext/dl/cfunc.c (リビジョン 12779) +++ ext/dl/cfunc.c (作業コピー) @@ -460,7 +460,11 @@ } } else{ - rb_raise(rb_eDLError, "unsupported call type: %x", cfunc->calltype); +#ifndef LONG_LONG_VALUE + rb_raise(rb_eDLError, "unsupported call type: %lx", cfunc->calltype); +#else + rb_raise(rb_eDLError, "unsupported call type: %llx", cfunc->calltype); +#endif } rb_dl_set_last_error(self, INT2NUM(errno)); Index: ext/openssl/ossl_x509name.c =================================================================== --- ext/openssl/ossl_x509name.c (リビジョン 12779) +++ ext/openssl/ossl_x509name.c (作業コピー) @@ -204,11 +204,11 @@ return ossl_x509name_to_s_old(self); else iflag = NUM2ULONG(flag); if (!(out = BIO_new(BIO_s_mem()))) - rb_raise(eX509NameError, NULL); + ossl_raise(eX509NameError, NULL); GetX509Name(self, name); if (!X509_NAME_print_ex(out, name, 0, iflag)){ BIO_free(out); - rb_raise(eX509NameError, NULL); + ossl_raise(eX509NameError, NULL); } str = ossl_membio2str(out); -- pegacorn