From: Katsuyuki Komatsu Date: 1999-05-13T23:09:22+09:00 Subject: [ruby-dev:6790] Re: Ruby 1.3.3-990513 小松です。 [ruby-dev:6731]では、gcc-2.8.1とegcs-1.1.2でしか試していませんでした ので、今回は全部ccを使ってみました。 (1) ext/pty/Makefileがruby-1.3.3-990513.tar.gzに残っている。 (2) warningが出るのですが、eval.cのrb_eval_string_wrap()の、 JUMP_TAG(state); は JUMP_TAG(*state); の間違い? 読み切れなかったのでパッチにはしていません。 (3) ext/socket/getnameinfo.cの__constで引っかかりました。 __constってどうしていままで通ってたんだろうと思ったら、 gccならOKなんですね。 % cat t.c __const char p[] = "Hello World!"; % gcc -c t.c % (4) AIXで、dln.cのloadbind()の所でwarningが出るので(void*)のcastを追加。 (5) ext/pty/pty.cの183行目の#errorがSunOS 4.1.4のccだと、 pty.c: 183: undefined control と出て通らないので、先頭が'#'で始まらないようにインデントした。 (6) SunOS 4.1.4のccで通らないので、ext/readline/readline.cと ext/tcltklib/tcltklib.cの関数定義の非ANSI化。 (7) SunOS 4.1.4のccにはoffsetofがないので、 offsetof(struct sockaddr_in, sin_addr) は、 (int)&((struct sockaddr_in *)0)->sin_addr などと書き換えるなりしなければならないが、configure.inか ext/socket/extconf.rbで判定してoffsetofのマクロを定義する ような形にすべきだと思うので、とりあえずレポートだけ。 引っかかったのは、 ext/socket/getaddrinfo.c 112行 ext/socket/getnameinfo.c 67行 です。 / / / [Solaris 2.5.1] WorkShop Compilers 4.2.1 04 Feb 1997 C 4.2.1 % env CC=cc CFLAGS=-O ./configure --with-readline-dir=/usr/local [SunOS 4.1.4] cc sparc-sunos4.1.4_JLとなるのを避けるため--hostを指定しています。 % env CC=cc CFLAGS=-O ./configure --host=sparc-sunos4.1.4 \ --with-readline-dir=/usr/local [HP-UX 10.20] HP92453-01 A.10.32.22 HP C Compiler (PHSS_17507) 今回はcc -Ae -O +Onolimitにしてみました。 % env CC='cc -Ae' CFLAGS='-O +Onolimit' ./configure \ --with-readline-dir=/usr/local [AIX 4.1.3] C Set++ 3.1.4.0 % env CC=cc CFLAGS='-O -qmaxmem=8192' ./configure \ --with-readline-dir=/usr/local / / / diff -r -u ruby-1.3.3-990513.orig/dln.c ruby-1.3.3-990513/dln.c --- ruby-1.3.3-990513.orig/dln.c Thu May 13 19:00:58 1999 +++ ruby-1.3.3-990513/dln.c Thu May 13 22:03:03 1999 @@ -1348,7 +1348,7 @@ if (init_fct == NULL) { aix_loaderror(file); } - if (loadbind(0, main_module, init_fct) == -1) { + if (loadbind(0, main_module, (void*)init_fct) == -1) { aix_loaderror(file); } (*init_fct)(); diff -r -u ruby-1.3.3-990513.orig/ext/pty/pty.c ruby-1.3.3-990513/ext/pty/pty.c --- ruby-1.3.3-990513.orig/ext/pty/pty.c Thu May 13 12:46:03 1999 +++ ruby-1.3.3-990513/ext/pty/pty.c Thu May 13 22:39:43 1999 @@ -180,7 +180,7 @@ rb_raise(rb_eRuntimeError, "Stopped: %d",cpid); } #else -#error "Either IF_STOPPED or WIFSTOPPED is needed" + #error "Either IF_STOPPED or WIFSTOPPED is needed" #endif /* WIFSTOPPED */ #endif /* IF_STOPPED */ if (n >= 0) { diff -r -u ruby-1.3.3-990513.orig/ext/readline/readline.c ruby-1.3.3-990513/ext/readline/readline.c --- ruby-1.3.3-990513.orig/ext/readline/readline.c Tue May 11 10:21:13 1999 +++ ruby-1.3.3-990513/ext/readline/readline.c Thu May 13 22:17:49 1999 @@ -23,7 +23,10 @@ } static VALUE -readline_readline(int argc, VALUE *argv, VALUE self) +readline_readline(argc, argv, self) + int argc; + VALUE *argv; + VALUE self; { VALUE tmp, add_hist, result; char *prompt = NULL; @@ -45,7 +48,9 @@ } static VALUE -readline_s_set_completion_proc(VALUE self, VALUE proc) +readline_s_set_completion_proc(self, proc) + VALUE self; + VALUE proc; { if (!rb_respond_to(proc, rb_intern("call"))) rb_raise(rb_eArgError, "argument have to respond to `call'"); @@ -53,25 +58,32 @@ } static VALUE -readline_s_get_completion_proc(VALUE self) +readline_s_get_completion_proc(self) + VALUE self; { return rb_iv_get(mReadline, COMPLETION_PROC); } static VALUE -readline_s_set_completion_case_fold(VALUE self, VALUE val) +readline_s_set_completion_case_fold(self, val) + VALUE self; + VALUE val; { return rb_iv_set(mReadline, COMPLETION_CASE_FOLD, val); } static VALUE -readline_s_get_completion_case_fold(VALUE self) +readline_s_get_completion_case_fold(self) + VALUE self; { return rb_iv_get(mReadline, COMPLETION_CASE_FOLD); } static char ** -readline_attempted_completion_function(char *text, int start, int end) +readline_attempted_completion_function(text, start, end) + char *text; + int start; + int end; { VALUE proc, ary, temp; char **result; @@ -133,27 +145,32 @@ } static VALUE -readline_s_vi_editing_mode(VALUE self) +readline_s_vi_editing_mode(self) + VALUE self; { rl_vi_editing_mode(1,0); return Qnil; } static VALUE -readline_s_emacs_editing_mode(VALUE self) +readline_s_emacs_editing_mode(self) + VALUE self; { rl_emacs_editing_mode(1,0); return Qnil; } static VALUE -hist_to_s(VALUE self) +hist_to_s(self) + VALUE self; { return rb_str_new2("HISTORY"); } static VALUE -hist_get(VALUE self, VALUE index) +hist_get(self, index) + VALUE self; + VALUE index; { HISTORY_STATE *state; int i; @@ -167,7 +184,10 @@ } static VALUE -hist_set(VALUE self, VALUE index, VALUE str) +hist_set(self, index, str) + VALUE self; + VALUE index; + VALUE str; { HISTORY_STATE *state; int i; @@ -182,15 +202,19 @@ } static VALUE -hist_push(VALUE self, VALUE str) +hist_push(self, str) + VALUE self; + VALUE str; { add_history(STR2CSTR(str)); return self; } static VALUE -hist_push_method(int argc, VALUE *argv, - VALUE self) +hist_push_method(argc, argv, self) + int argc; + VALUE *argv; + VALUE self; { VALUE str; @@ -202,7 +226,8 @@ } static VALUE -hist_pop(VALUE self) +hist_pop(self) + VALUE self; { HISTORY_STATE *state; HIST_ENTRY *entry; @@ -217,7 +242,8 @@ } static VALUE -hist_shift(VALUE self) +hist_shift(self) + VALUE self; { HISTORY_STATE *state; HIST_ENTRY *entry; @@ -232,7 +258,8 @@ } static VALUE -hist_each(VALUE self) +hist_each(self) + VALUE self; { HISTORY_STATE *state; int i; @@ -245,7 +272,8 @@ } static VALUE -hist_length(VALUE self) +hist_length(self) + VALUE self; { HISTORY_STATE *state; @@ -254,7 +282,8 @@ } static VALUE -hist_empty_p(VALUE self) +hist_empty_p(self) + VALUE self; { HISTORY_STATE *state; @@ -266,7 +295,9 @@ } static VALUE -hist_delete_at(VALUE self, VALUE index) +hist_delete_at(self, index) + VALUE self; + VALUE index; { HISTORY_STATE *state; HIST_ENTRY *entry; @@ -282,7 +313,9 @@ } static VALUE -filename_completion_proc_call(VALUE self, VALUE str) +filename_completion_proc_call(self, str) + VALUE self; + VALUE str; { VALUE result; char **matches; @@ -307,7 +340,9 @@ } static VALUE -username_completion_proc_call(VALUE self, VALUE str) +username_completion_proc_call(self, str) + VALUE self; + VALUE str; { VALUE result; char **matches; @@ -332,7 +367,7 @@ } void -Init_readline(void) +Init_readline() { VALUE histary, fcomp, ucomp; diff -r -u ruby-1.3.3-990513.orig/ext/socket/getnameinfo.c ruby-1.3.3-990513/ext/socket/getnameinfo.c --- ruby-1.3.3-990513.orig/ext/socket/getnameinfo.c Sat May 8 00:34:36 1999 +++ ruby-1.3.3-990513/ext/socket/getnameinfo.c Thu May 13 22:29:28 1999 @@ -86,7 +86,7 @@ static const char * inet_ntop(af, addr, numaddr, numaddr_len) int af; - __const void *addr; + const void *addr; char *numaddr; size_t numaddr_len; { diff -r -u ruby-1.3.3-990513.orig/ext/tcltklib/tcltklib.c ruby-1.3.3-990513/ext/tcltklib/tcltklib.c --- ruby-1.3.3-990513.orig/ext/tcltklib/tcltklib.c Tue Apr 20 17:41:52 1999 +++ ruby-1.3.3-990513/ext/tcltklib/tcltklib.c Thu May 13 22:37:06 1999 @@ -49,7 +49,8 @@ } Tk_TimerData; /* timer callback */ -void _timer_for_tcl (ClientData clientData) +void _timer_for_tcl(clientData) + ClientData clientData; { Tk_TimerData *timer = (Tk_TimerData*)clientData; @@ -64,7 +65,8 @@ /* execute Tk_MainLoop */ static VALUE -lib_mainloop(VALUE self) +lib_mainloop(self) + VALUE self; { Tk_TimerData *timer; @@ -95,7 +97,9 @@ /* Tcl command `ruby' */ static VALUE -ip_eval_rescue(VALUE *failed, VALUE einfo) +ip_eval_rescue(failed, einfo) + VALUE *failed; + VALUE einfo; { *failed = einfo; return Qnil; @@ -103,10 +107,17 @@ static int #if TCL_MAJOR_VERSION >= 8 -ip_ruby(ClientData clientData, Tcl_Interp *interp, - int argc, Tcl_Obj *CONST argv[]) +ip_ruby(clientData, interp, argc, argv) + ClientData clientData; + Tcl_Interp *interp; + int argc; + Tcl_Obj *CONST argv[]; #else -ip_ruby(ClientData clientData, Tcl_Interp *interp, int argc, char *argv[]) +ip_ruby(clientData, interp, argc, argv) + ClientData clientData; + Tcl_Interp *interp; + int argc; + char *argv[]; #endif { VALUE res; @@ -163,7 +174,8 @@ /* destroy interpreter */ static void -ip_free(struct tcltkip *ptr) +ip_free(ptr) + struct tcltkip *ptr; { DUMP1("Tcl_DeleteInterp"); Tcl_DeleteInterp(ptr->ip); @@ -172,7 +184,8 @@ /* create and initialize interpreter */ static VALUE -ip_new(VALUE self) +ip_new(self) + VALUE self; { struct tcltkip *ptr; /* tcltkip data struct */ VALUE obj; /* newly created object */ @@ -214,7 +227,9 @@ /* eval string in tcl by Tcl_Eval() */ static VALUE -ip_eval(VALUE self, VALUE str) +ip_eval(self, str) + VALUE self; + VALUE str; { char *s; char *buf; /* Tcl_Eval requires re-writable string region */ @@ -240,7 +255,10 @@ static VALUE -ip_toUTF8(VALUE self, VALUE str, VALUE encodename) +ip_toUTF8(self, str, encodename) + VALUE self; + VALUE str; + VALUE encodename; { #ifndef TCL_UTF_MAX return str; @@ -272,7 +290,10 @@ } static VALUE -ip_fromUTF8(VALUE self, VALUE str, VALUE encodename) +ip_fromUTF8(self, str, encodename) + VALUE self; + VALUE str; + VALUE encodename; { #ifndef TCL_UTF_MAX return str; @@ -305,7 +326,10 @@ static VALUE -ip_invoke(int argc, VALUE *argv, VALUE obj) +ip_invoke(argc, argv, obj) + int argc; + VALUE *argv; + VALUE obj; { struct tcltkip *ptr; /* tcltkip data struct */ int i; @@ -384,7 +408,8 @@ /* get return code from Tcl_Eval() */ static VALUE -ip_retval(VALUE self) +ip_retval(self) + VALUE self; { struct tcltkip *ptr; /* tcltkip data struct */ -- 小松克行 (株)サリオンシステムズリサーチ ソフトウェア開発部 Katsuyuki Komatsu