[#4745] Win32: Ruby & APR; build problems for Ruby Subversion SWIG bindings — Erik Huelsmann <ehuels@...>

Having taken upon me the task to provide a Windows build for

24 messages 2005/04/20
[#4746] Re: Win32: Ruby & APR; build problems for Ruby Subversion SWIG bindings — Austin Ziegler <halostatue@...> 2005/04/20

On 4/20/05, Erik Huelsmann <ehuels@gmail.com> wrote:

[#4747] Re: Win32: Ruby & APR; build problems for Ruby Subversion SWIG bindings — Erik Huelsmann <ehuels@...> 2005/04/20

Hi Austin,

[#4762] Re: Win32: Ruby & APR; build problems for Ruby Subversion SWIG bindings — nobu.nokada@... 2005/04/24

Hi,

[#4783] Re: Win32: Ruby & APR; build problems for Ruby Subversion SWIG bindings — Erik Huelsmann <ehuels@...> 2005/04/25

On 4/24/05, nobu.nokada@softhome.net <nobu.nokada@softhome.net> wrote:

[#4787] Re: Win32: Ruby & APR; build problems for Ruby Subversion SWIG bindings — nobu.nokada@... 2005/04/25

Hi,

[#4794] Re: Win32: Ruby & APR; build problems for Ruby Subversion SWIG bindings — Erik Huelsmann <ehuels@...> 2005/04/25

> > > Ruby is just using AC_TYPE_UID_T. So, using typedef for them,

[#4751] Illegal regexp causes segfault — Andrew Walrond <andrew@...>

irb(main):058:0> a = /\[([^]]*)\]/

13 messages 2005/04/22

Re: -Wall

From: "Kirill A. Shutemov" <k.shutemov@...>
Date: 2005-04-29 09:22:26 UTC
List: ruby-core #4816
On 14:41 ヤ 29 誨哮 nobu.nokada@softhome.net wrote:
> Hi,
> 
> At Thu, 28 Apr 2005 23:48:22 +0900,
> Kirill A. Shutemov wrote in [ruby-core:04806]:
> > Why does ruby build without -Wall in CFLAGS by default? -Wall can help to
> > resolve some potential problem.
> 
> I confirmed many "parentheses around assignment" warnings and
> "might be used uninitialized" except for time_mload() have no
> problem, but "type-punned pointer" warnings seem a bit more
> problematic.  And also:
> 
> * dir.c:file_s_fnmatch() has comment leaders within its comment,
> 
> * hash.c:rb_hash_hash_i() should be static,
> 
> * re.c should include regint.h for declarations of oniguruma
>   functions.
I have some additional warnings(gcc-3.4, i586):
  * eval.c: In function `rb_exec_recursive':
    eval.c:13185: warning: 'result' might be used uninitialized in this
      function
   
    resolved by set default value

  * io.c: In function `rb_io_initialize':
    io.c:4007: warning: 'flags' might be used uninitialized in this function
   
    resolved by set default value

  * parse.y:6585: warning: 'nodetype' defined but not used
    parse.y:6592: warning: 'nodeline' defined but not used
    
    I don't know how resolve it...

  * process.c: In function `p_sys_setresuid':
    process.c:2191: warning: implicit declaration of function `setresuid'
    process.c: In function `p_sys_setresgid':
    process.c:2535: warning: implicit declaration of function `setresgid'
    
    resolved by define __USE_GNU if use glibc

  * process.c:1541: warning: 'hfunc' might be used uninitialized in this 
      function
    process.c:1541: warning: 'qfunc' might be used uninitialized in this
      function
    process.c:1541: warning: 'ifunc' might be used uninitialized in this
      function
 
    resolved by set default value

  * ruby.c: In function `process_sflag':
    ruby.c:422: warning: suggest parentheses around assignment used as truth
      value
 
    resolved by test if not equal zero

  * util.c: In function `ruby_strtod':
    util.c:755: warning: 'pMant' might be used uninitialized in this
      function
   
    resolved by set default value

Patch with my changes combinated with your changes in attachment...
It will be great if someboby commit it.

-- 
Kirill A. Shutemov				Belarus, Minsk
E-mail:	k.shutemov (AT) sam-solutions.net
JID: kas (AT) altlinux.org
ICQ: 152302675

Television has proved that people will look at anything rather than each other.
		-- Ann Landers

Attachments (1)

warnings.patch (26.7 KB, text/x-diff)
Index: bignum.c
===================================================================
RCS file: /src/ruby/bignum.c,v
retrieving revision 1.110
diff -u -r1.110 bignum.c
--- bignum.c	4 Mar 2005 06:47:45 -0000	1.110
+++ bignum.c	29 Apr 2005 09:14:11 -0000
@@ -456,7 +456,7 @@
     z = bignew(len, sign);
     zds = BDIGITS(z);
     for (i=len;i--;) zds[i]=0;
-    while (c = *str++) {
+    while ((c = *str++) != '\0') {
 	if (c == '_') {
 	    if (badcheck) {
 		if (nondigit) goto bad;
Index: dir.c
===================================================================
RCS file: /src/ruby/dir.c,v
retrieving revision 1.138
diff -u -r1.138 dir.c
--- dir.c	11 Apr 2005 13:30:10 -0000	1.138
+++ dir.c	29 Apr 2005 09:14:13 -0000
@@ -259,7 +259,7 @@
 	    const char *t;
 	    if (ISEND(s))
 		RETURN(FNM_NOMATCH);
-	    if (t = bracket(p + 1, s, flags)) {
+	    if ((t = bracket(p + 1, s, flags)) != 0) {
 		p = t;
 		Inc(s);
 		continue;
@@ -966,7 +966,7 @@
     register const char *p = s;
     register char c;
 
-    while (c = *p++) {
+    while ((c = *p++) != '\0'){
 	switch (c) {
 	  case '*':
 	  case '?':
@@ -997,7 +997,7 @@
     register char c;
     int open = 0;
 
-    while (c = *p++) {
+    while ((c = *p++) != '\0') {
 	switch (c) {
 	  case '[':
 	    open = 1;
@@ -1210,18 +1210,21 @@
 	    p = p->next;
 	}
 	switch (p->type) {
-	case PLAIN:
+	  case PLAIN:
 	    plain = 1;
 	    break;
-	case MAGICAL:
+	  case MAGICAL:
 	    magical = 1;
 	    break;
-	case MATCH_ALL:
+	  case MATCH_ALL:
 	    match_all = 1;
 	    break;
-	case MATCH_DIR:
+	  case MATCH_DIR:
 	    match_dir = 1;
 	    break;
+	  case RECURSIVE:
+	    /* not reached */
+	    break;
 	}
     }
 
@@ -1607,7 +1610,6 @@
 dir_open_dir(path)
     VALUE path;
 {
-    struct dir_data *dp;
     VALUE dir = rb_funcall(rb_cDir, rb_intern("open"), 1, path);
 
     if (TYPE(dir) != T_DATA ||
@@ -1738,8 +1740,8 @@
  *     File.fnmatch('**.rb', 'lib/song.rb')                #=> true
  *     File.fnmatch('*',           'dave/.profile')                      #=> true
  *
- *     File.fnmatch('* IGNORE /*', 'dave/.profile', File::FNM_PATHNAME)  #=> false
- *     File.fnmatch('* IGNORE /*', 'dave/.profile', File::FNM_PATHNAME | File::FNM_DOTMATCH) #=> true
+ *     File.fnmatch('* IGNORE / IGNORE *', 'dave/.profile', File::FNM_PATHNAME)  #=> false
+ *     File.fnmatch('* IGNORE / IGNORE *', 'dave/.profile', File::FNM_PATHNAME | File::FNM_DOTMATCH) #=> true
  *
  *     File.fnmatch('** IGNORE /foo', 'a/b/c/foo', File::FNM_PATHNAME)     #=> true
  *     File.fnmatch('** IGNORE /foo', '/a/b/c/foo', File::FNM_PATHNAME)    #=> true
Index: eval.c
===================================================================
RCS file: /src/ruby/eval.c,v
retrieving revision 1.775
diff -u -r1.775 eval.c
--- eval.c	23 Apr 2005 02:45:38 -0000	1.775
+++ eval.c	29 Apr 2005 09:14:16 -0000
@@ -374,16 +374,16 @@
     VALUE klass, *origin;
     ID id;
 {
-    NODE *body;
+    st_data_t body;
 
     if (!klass) return 0;
-    while (!st_lookup(RCLASS(klass)->m_tbl, id, (st_data_t *)&body)) {
+    while (!st_lookup(RCLASS(klass)->m_tbl, id, &body)) {
 	klass = RCLASS(klass)->super;
 	if (!klass) return 0;
     }
 
     if (origin) *origin = klass;
-    return body;
+    return (NODE *)body;
 }
 
 static NODE*
@@ -468,7 +468,7 @@
     VALUE klass;
     ID mid;
 {
-    NODE *body;
+    st_data_t body;
 
     if (klass == rb_cObject) {
 	rb_secure(4);
@@ -480,8 +480,8 @@
     if (mid == __id__ || mid == __send__ || mid == init) {
 	rb_warn("removing `%s' may cause serious problem", rb_id2name(mid));
     }
-    if (!st_delete(RCLASS(klass)->m_tbl, &mid, (st_data_t *)&body) ||
-	!body->nd_body) {
+    if (!st_delete(RCLASS(klass)->m_tbl, &mid, &body) ||
+	!((NODE *)body)->nd_body) {
 	rb_name_error(mid, "method `%s' not defined in %s",
 		      rb_id2name(mid), rb_class2name(klass));
     }
@@ -1201,7 +1201,7 @@
 	    long len = elen;
 
 	    if (RSTRING(epath)->ptr[0] == '#') epath = 0;
-	    if (tail = memchr(einfo, '\n', elen)) {
+	    if ((tail = memchr(einfo, '\n', elen)) != 0) {
 		len = tail - einfo;
 		tail++;		/* skip newline */
 	    }
@@ -1515,7 +1515,9 @@
 
 extern NODE *ruby_eval_tree;
 
+#if 0
 static void cont_call _((VALUE));
+#endif
 
 static int
 ruby_exec_internal()
@@ -2057,7 +2059,8 @@
     ID name, def;
 {
     VALUE origin;
-    NODE *orig, *body, *node;
+    NODE *orig, *body;
+    st_data_t data;
     VALUE singleton = 0;
 
     rb_frozen_class_p(klass);
@@ -2086,7 +2089,8 @@
     }
 
     rb_clear_cache_by_id(name);
-    if (RTEST(ruby_verbose) && st_lookup(RCLASS(klass)->m_tbl, name, (st_data_t *)&node)) {
+    if (RTEST(ruby_verbose) && st_lookup(RCLASS(klass)->m_tbl, name, &data)) {
+	NODE *node = (NODE *)data;
 	if (node->nd_cnt == 0 && node->nd_body) {
 	    rb_warning("discarding old %s", rb_id2name(name));
 	}
@@ -3830,6 +3834,7 @@
 	    VALUE recv = rb_eval(self, node->nd_recv);
 	    VALUE klass;
 	    NODE *body = 0, *defn;
+	    st_data_t data;
 
 	    if (ruby_safe_level >= 4 && !OBJ_TAINTED(recv)) {
 		rb_raise(rb_eSecurityError, "Insecure: can't define singleton method");
@@ -3843,7 +3848,8 @@
 
 	    if (OBJ_FROZEN(recv)) rb_error_frozen("object");
 	    klass = rb_singleton_class(recv);
-	    if (st_lookup(RCLASS(klass)->m_tbl, node->nd_mid, (st_data_t *)&body)) {
+	    if (st_lookup(RCLASS(klass)->m_tbl, node->nd_mid, &data)) {
+		body = (NODE *)data;
 		if (ruby_safe_level >= 4) {
 		    rb_raise(rb_eSecurityError, "redefining method prohibited");
 		}
@@ -5265,7 +5271,7 @@
 	VALUE eclass;
 
 	va_init_list(args, data2);
-	while (eclass = va_arg(args, VALUE)) {
+	while ((eclass = va_arg(args, VALUE)) != 0) {
 	    if (rb_obj_is_kind_of(ruby_errinfo, eclass)) {
 		handle = Qtrue;
 		break;
@@ -6019,7 +6025,7 @@
     int argc;
     const VALUE *argv;
 {
-    VALUE result, self, klass, k;
+    VALUE result, self, klass;
 
     if (ruby_frame->this_class == 0) {
 	rb_name_error(ruby_frame->callee, "calling `super' from `%s' is prohibited",
@@ -6882,7 +6888,7 @@
     if (ext && !strchr(ext, '/')) {
 	if (strcmp(".rb", ext) == 0) {
 	    if (rb_feature_p(ftptr, ext, Qtrue)) return 'r';
-	    if (tmp = rb_find_file(fname)) {
+	    if ((tmp = rb_find_file(fname)) != 0) {
 		tmp = rb_file_expand_path(tmp, Qnil);
 		ext = strrchr(ftptr = RSTRING(tmp)->ptr, '.');
 		if (!rb_feature_p(ftptr, ext, Qtrue))
@@ -6906,7 +6912,7 @@
 #else
 	    rb_str_cat2(tmp, DLEXT);
 	    OBJ_FREEZE(tmp);
-	    if (tmp = rb_find_file(tmp)) {
+	    if ((tmp = rb_find_file(tmp)) != 0) {
 		tmp = rb_file_expand_path(tmp, Qnil);
 		ext = strrchr(ftptr = RSTRING(tmp)->ptr, '.');
 		if (!rb_feature_p(ftptr, ext, Qfalse))
@@ -6917,7 +6923,7 @@
 	}
 	else if (IS_DLEXT(ext)) {
 	    if (rb_feature_p(ftptr, ext, Qfalse)) return 's';
-	    if (tmp = rb_find_file(fname)) {
+	    if ((tmp = rb_find_file(fname)) != 0) {
 		tmp = rb_file_expand_path(tmp, Qnil);
 		ext = strrchr(ftptr = RSTRING(tmp)->ptr, '.');
 		if (!rb_feature_p(ftptr, ext, Qfalse))
@@ -6926,7 +6932,7 @@
 	    }
 	}
     }
-    else if (ext = rb_feature_p(ftptr, 0, Qfalse)) {
+    else if ((ext = rb_feature_p(ftptr, 0, Qfalse)) != 0) {
 	return (*ext && (IS_SOEXT(ext) || IS_DLEXT(ext))) ? 's' : 'r';
     }
     tmp = fname;
@@ -7028,7 +7034,8 @@
     SCOPE_SET(saved.vmode);
     ruby_safe_level = saved.safe;
     if (ftptr) {
-	if (st_delete(loading_tbl, (st_data_t *)&ftptr, 0)) { /* loading done */
+	st_data_t data = (st_data_t)ftptr;
+	if (st_delete(loading_tbl, &data, 0)) { /* loading done */
 	    free(ftptr);
 	}
     }
@@ -7738,9 +7745,9 @@
     __id__ = rb_intern("__id__");
     __send__ = rb_intern("__send__");
 
-    rb_global_variable((VALUE*)&top_scope);
-    rb_global_variable((VALUE*)&ruby_eval_tree);
-    rb_global_variable((VALUE*)&ruby_dyna_vars);
+    rb_global_variable((VALUE *)(void *)&top_scope);
+    rb_global_variable((VALUE *)(void *)&ruby_eval_tree);
+    rb_global_variable((VALUE *)(void *)&ruby_dyna_vars);
 
     rb_define_virtual_variable("$@", errat_getter, errat_setter);
     rb_define_hooked_variable("$!", &ruby_errinfo, 0, errinfo_setter);
@@ -7754,7 +7761,7 @@
     rb_define_method(rb_mKernel, "respond_to?", rb_obj_respond_to, -1);
     respond_to   = rb_intern("respond_to?");
     basic_respond_to = rb_method_node(rb_cObject, respond_to);
-    rb_global_variable((VALUE*)&basic_respond_to);
+    rb_global_variable((VALUE *)(void *)&basic_respond_to);
     
     rb_define_global_function("raise", rb_f_raise, -1);
     rb_define_global_function("fail", rb_f_raise, -1);
@@ -8670,7 +8677,6 @@
     VALUE proc;
 {
     VALUE b;
-    struct BLOCK * volatile old_block;
     struct BLOCK _block;
     struct BLOCK *data;
     volatile VALUE result = Qnil;
@@ -11921,7 +11927,7 @@
     VALUE (*fn)();
     void *arg;
 {
-    Init_stack((VALUE*)&arg);
+    Init_stack((void *)&arg);
     return rb_thread_start_0(fn, arg, rb_thread_alloc(rb_cThread));
 }
 
@@ -12887,7 +12893,6 @@
 
 /* variables for recursive traversals */
 static ID recursive_key;
-static VALUE recursive_tbl;
 
 
 /*
@@ -13177,7 +13182,7 @@
 	return (*func)(obj, arg, Qtrue);
     }
     else {
-	VALUE result;
+	VALUE result = Qnil;
 	int state;
 
 	recursive_push(obj);
Index: gc.c
===================================================================
RCS file: /src/ruby/gc.c,v
retrieving revision 1.197
diff -u -r1.197 gc.c
--- gc.c	4 Mar 2005 06:47:43 -0000	1.197
+++ gc.c	29 Apr 2005 09:14:16 -0000
@@ -518,8 +518,12 @@
     const char *f;
 {
     char *name;
+    st_data_t data;
 
-    if (!st_lookup(source_filenames, (st_data_t)f, (st_data_t *)&name)) {
+    if (st_lookup(source_filenames, (st_data_t)f, &data)) {
+	name = (char *)data;
+    }
+    else {
 	long len = strlen(f) + 1;
 	char *ptr = name = ALLOC_N(char, len + 1);
 	*ptr++ = 0;
Index: hash.c
===================================================================
RCS file: /src/ruby/hash.c,v
retrieving revision 1.148
diff -u -r1.148 hash.c
--- hash.c	2 Apr 2005 04:23:56 -0000	1.148
+++ hash.c	29 Apr 2005 09:14:17 -0000
@@ -1496,7 +1496,7 @@
     return hash_equal(hash1, hash2, Qtrue);
 }
 
-
+static int
 rb_hash_hash_i(key, value, hp)
     VALUE key, value;
     long *hp;
Index: io.c
===================================================================
RCS file: /src/ruby/io.c,v
retrieving revision 1.366
diff -u -r1.366 io.c
--- io.c	7 Mar 2005 02:05:07 -0000	1.366
+++ io.c	29 Apr 2005 09:14:18 -0000
@@ -4004,7 +4004,7 @@
 {
     VALUE fnum, mode, orig;
     OpenFile *fp, *ofp = NULL;
-    int fd, flags, fmode;
+    int fd, flags = 0, fmode;
 
     rb_secure(4);
     rb_scan_args(argc, argv, "11", &fnum, &mode);
Index: marshal.c
===================================================================
RCS file: /src/ruby/marshal.c,v
retrieving revision 1.120
diff -u -r1.120 marshal.c
--- marshal.c	4 Mar 2005 06:47:42 -0000	1.120
+++ marshal.c	29 Apr 2005 09:14:18 -0000
@@ -374,7 +374,7 @@
     char *path;
 
     if (FL_TEST(klass, FL_SINGLETON)) {
-	if (check && RCLASS(klass)->m_tbl->num_entries ||
+	if ((check && RCLASS(klass)->m_tbl->num_entries) ||
 	    (RCLASS(klass)->iv_tbl && RCLASS(klass)->iv_tbl->num_entries > 1)) {
 	    rb_raise(rb_eTypeError, "singleton can't be dumped");
 	}
@@ -468,7 +468,7 @@
 	return;
     }
 
-    if (ivtbl = rb_generic_ivar_table(obj)) {
+    if ((ivtbl = rb_generic_ivar_table(obj)) != 0) {
 	w_byte(TYPE_IVAR, arg);
     }
     if (obj == Qnil) {
Index: numeric.c
===================================================================
RCS file: /src/ruby/numeric.c,v
retrieving revision 1.119
diff -u -r1.119 numeric.c
--- numeric.c	18 Apr 2005 06:38:30 -0000	1.119
+++ numeric.c	29 Apr 2005 09:14:19 -0000
@@ -1517,7 +1517,7 @@
 	    char *s;
 
 	    sprintf(buf, "%-.10g", RFLOAT(val)->value);
-	    if (s = strchr(buf, ' ')) *s = '\0';
+	    if ((s = strchr(buf, ' ')) != 0) *s = '\0';
 	    rb_raise(rb_eRangeError, "float %s out of range of integer", buf);
 	}
 
@@ -1668,7 +1668,7 @@
 	    char *s;
 
 	    sprintf(buf, "%-.10g", RFLOAT(val)->value);
-	    if (s = strchr(buf, ' ')) *s = '\0';
+	    if ((s = strchr(buf, ' ')) != 0) *s = '\0';
 	    rb_raise(rb_eRangeError, "float %s out of range of long long", buf);
 	}
 
Index: parse.y
===================================================================
RCS file: /src/ruby/parse.y,v
retrieving revision 1.377
diff -u -r1.377 parse.y
--- parse.y	14 Apr 2005 10:05:27 -0000	1.377
+++ parse.y	29 Apr 2005 09:14:21 -0000
@@ -48,8 +48,6 @@
 	 ((id)&ID_SCOPE_MASK) == ID_INSTANCE || \
 	 ((id)&ID_SCOPE_MASK) == ID_CLASS))
 
-static int is_valid_lvar _((ID id));
-
 #ifndef RIPPER
 char *ruby_sourcefile;		/* current source file */
 int   ruby_sourceline;		/* current line no. */
@@ -2464,11 +2462,10 @@
 		    }
 		| tLPAREN_ARG expr {lex_state = EXPR_ENDARG;} rparen
 		    {
+		        rb_warning0("(...) interpreted as grouped expression");
 		    /*%%%*/
-		        rb_warning("(...) interpreted as grouped expression");
 			$$ = $2;
 		    /*%
-		        rb_warning0("(...) interpreted as grouped expression");
 			$$ = dispatch1(paren, $2);
 		    %*/
 		    }
@@ -8143,6 +8140,7 @@
     ID id;
 {
     char *name;
+    st_data_t data;
 
     if (id < tLAST_TOKEN) {
 	int i = 0;
@@ -8153,8 +8151,8 @@
 	}
     }
 
-    if (st_lookup(sym_rev_tbl, id, (st_data_t *)&name))
-	return name;
+    if (st_lookup(sym_rev_tbl, id, &data))
+	return (char *)data;
 
     if (is_attrset_id(id)) {
 	ID id2 = (id & ~ID_SCOPE_MASK) | ID_LOCAL;
Index: process.c
===================================================================
RCS file: /src/ruby/process.c,v
retrieving revision 1.129
diff -u -r1.129 process.c
--- process.c	4 Mar 2005 06:47:41 -0000	1.129
+++ process.c	29 Apr 2005 09:14:22 -0000
@@ -21,6 +21,10 @@
 #include <stdlib.h>
 #endif
 #ifdef HAVE_UNISTD_H
+#define __USE_XOPEN_EXTENDED
+#ifdef __GLIBC__
+#define __USE_GNU
+#endif
 #include <unistd.h>
 #endif
 #ifdef HAVE_FCNTL_H
@@ -1046,8 +1050,8 @@
 	    if (nl) s = nl;
 	}
 	if (*s != ' ' && !ISALPHA(*s) && strchr("*?{}[]<>()~&|\\$;'`\"\n",*s)) {
-	    int status;
 #if defined(MSDOS)
+	    int status;
 	    before_exec();
 	    status = system(str);
 	    after_exec();
@@ -1055,7 +1059,7 @@
 		exit(status);
 #elif defined(__human68k__) || defined(__CYGWIN32__) || defined(__EMX__)
 	    char *shell = dln_find_exe("sh", 0);
-	    status = -1;
+	    int status = -1;
 	    before_exec();
 	    if (shell)
 		execl(shell, "sh", "-c", str, (char *) NULL);
@@ -1076,8 +1080,8 @@
     ss = ALLOCA_N(char, s-str+1);
     memcpy(ss, str, s-str);
     ss[s-str] = '\0';
-    if (*a++ = strtok(ss, " \t")) {
-	while (t = strtok(NULL, " \t")) {
+    if ((*a++ = strtok(ss, " \t")) != 0) {
+	while ((t = strtok(NULL, " \t")) != 0) {
 	    *a++ = t;
 	}
 	*a = NULL;
@@ -1534,7 +1538,9 @@
     int pid;
 {
     static int overriding;
-    RETSIGTYPE (*hfunc)_((int)), (*qfunc)_((int)), (*ifunc)_((int));
+    RETSIGTYPE (*hfunc)_((int))=NULL;
+    RETSIGTYPE (*qfunc)_((int))=NULL;
+    RETSIGTYPE (*ifunc)_((int))=NULL;
     int status;
     int i, hooked = Qfalse;
 
Index: re.c
===================================================================
RCS file: /src/ruby/re.c,v
retrieving revision 1.139
diff -u -r1.139 re.c
--- re.c	16 Mar 2005 09:25:44 -0000	1.139
+++ re.c	29 Apr 2005 09:14:22 -0000
@@ -11,6 +11,7 @@
 
 #include "ruby.h"
 #include "re.h"
+#include "regint.h"
 #include <ctype.h>
 
 #define MBCTYPE_ASCII         0
@@ -79,11 +80,9 @@
     char *p1, *p2;
     long len;
 {
-    int tmp;
-
     while (len--) {
-	if (tmp = casetable[(unsigned)*p1++] - casetable[(unsigned)*p2++])
-	    return tmp;
+	int tmp = casetable[(unsigned)*p1++] - casetable[(unsigned)*p2++];
+	if (tmp) return tmp;
     }
     return 0;
 }
Index: regparse.c
===================================================================
RCS file: /src/ruby/regparse.c,v
retrieving revision 1.17
diff -u -r1.17 regparse.c
--- regparse.c	24 Apr 2005 16:23:15 -0000	1.17
+++ regparse.c	29 Apr 2005 09:14:25 -0000
@@ -3254,13 +3254,17 @@
     switch (c) {
     case '.':
       if (! IS_SYNTAX_OP(syn, ONIG_SYN_OP_DOT_ANYCHAR)) break;
+#ifdef USE_VARIABLE_META_CHARS
     any_char:
+#endif
       tok->type = TK_ANYCHAR;
       break;
 
     case '*':
       if (! IS_SYNTAX_OP(syn, ONIG_SYN_OP_ASTERISK_ZERO_INF)) break;
+#ifdef USE_VARIABLE_META_CHARS
     anytime:
+#endif
       tok->type = TK_OP_REPEAT;
       tok->u.repeat.lower = 0;
       tok->u.repeat.upper = REPEAT_INFINITE;
@@ -3269,7 +3273,9 @@
 
     case '+':
       if (! IS_SYNTAX_OP(syn, ONIG_SYN_OP_PLUS_ONE_INF)) break;
+#ifdef USE_VARIABLE_META_CHARS
     one_or_more_time:
+#endif
       tok->type = TK_OP_REPEAT;
       tok->u.repeat.lower = 1;
       tok->u.repeat.upper = REPEAT_INFINITE;
@@ -3278,7 +3284,9 @@
 
     case '?':
       if (! IS_SYNTAX_OP(syn, ONIG_SYN_OP_QMARK_ZERO_ONE)) break;
+#ifdef USE_VARIABLE_META_CHARS
     zero_or_one_time:
+#endif
       tok->type = TK_OP_REPEAT;
       tok->u.repeat.lower = 0;
       tok->u.repeat.upper = 1;
@@ -3381,7 +3389,9 @@
     }
   }
 
+#ifdef USE_VARIABLE_META_CHARS
  out:
+#endif
   *src = p;
   return tok->type;
 }
Index: ruby.c
===================================================================
RCS file: /src/ruby/ruby.c,v
retrieving revision 1.99
diff -u -r1.99 ruby.c
--- ruby.c	27 Apr 2005 23:21:58 -0000	1.99
+++ ruby.c	29 Apr 2005 09:14:25 -0000
@@ -199,7 +199,7 @@
 	p = path;
 	while (*p) {
 	    while (*p == sep) p++;
-	    if (s = strchr(p, sep)) {
+	    if ((s = strchr(p, sep)) != 0) {
 		rb_ary_push(ary, (*filter)(rubylib_mangled_path(p, (int)(s-p))));
 		p = s + 1;
 	    }
@@ -419,7 +419,7 @@
 	    if (s[1] == '-' && s[2] == '\0') break;
 
 	    s[0] = '$';
-	    if (p = strchr(s, '=')) {
+	    if ((p = strchr(s, '=')) != 0) {
 		*p++ = '\0';
 		rb_gv_set(s, rb_str_new2(p));
 	    }
@@ -740,7 +740,7 @@
 
     if (rb_safe_level() == 0 && (s = getenv("RUBYOPT"))) {
 	while (ISSPACE(*s)) s++;
-	if (*s == 'T' || *s == '-' && *(s+1) == 'T') {
+	if (*s == 'T' || (*s == '-' && *(s+1) == 'T')) {
 	    int numlen;
 	    int v = 1;
 
@@ -884,7 +884,7 @@
 		if (RSTRING(line)->len > 2
 		    && RSTRING(line)->ptr[0] == '#'
 		    && RSTRING(line)->ptr[1] == '!') {
-		    if (p = strstr(RSTRING(line)->ptr, "ruby")) {
+		    if ((p = strstr(RSTRING(line)->ptr, "ruby")) != 0) {
 			goto start_read;
 		    }
 		}
@@ -936,7 +936,7 @@
 		RSTRING(line)->ptr[RSTRING(line)->len-1] = '\0';
 		if (RSTRING(line)->ptr[RSTRING(line)->len-2] == '\r')
 		    RSTRING(line)->ptr[RSTRING(line)->len-2] = '\0';
-		if (p = strstr(p, " -")) {
+		if ((p = strstr(p, " -")) != 0) {
 		    p++;	/* skip space before `-' */
 		    while (*p == '-') {
 			p = moreswitches(p+1);
Index: signal.c
===================================================================
RCS file: /src/ruby/signal.c,v
retrieving revision 1.59
diff -u -r1.59 signal.c
--- signal.c	4 Mar 2005 06:47:41 -0000	1.59
+++ signal.c	29 Apr 2005 09:14:25 -0000
@@ -436,6 +436,7 @@
     }
 }
 
+#if defined(HAVE_NATIVETHREAD) && defined(HAVE_NATIVETHREAD_KILL)
 static void
 sigsend_to_ruby_thread(sig)
     int sig;
@@ -458,6 +459,7 @@
     ruby_native_thread_kill(sig);
 #endif
 }
+#endif
 
 static RETSIGTYPE sighandler _((int));
 static RETSIGTYPE
Index: struct.c
===================================================================
RCS file: /src/ruby/struct.c,v
retrieving revision 1.63
diff -u -r1.63 struct.c
--- struct.c	18 Apr 2005 06:38:30 -0000	1.63
+++ struct.c	29 Apr 2005 09:14:26 -0000
@@ -250,7 +250,7 @@
     ary = rb_ary_new();
 
     va_init_list(ar, name);
-    while (mem = va_arg(ar, char*)) {
+    while ((mem = va_arg(ar, char*)) != 0) {
 	ID slot = rb_intern(mem);
 	rb_ary_push(ary, ID2SYM(slot));
     }
Index: time.c
===================================================================
RCS file: /src/ruby/time.c,v
retrieving revision 1.103
diff -u -r1.103 time.c
--- time.c	4 Mar 2005 06:47:41 -0000	1.103
+++ time.c	29 Apr 2005 09:14:27 -0000
@@ -1981,6 +1981,7 @@
     if ((p & (1<<31)) == 0) {
 	sec = p;
 	usec = s;
+	gmt = 0;		/* very old dump, assuming local time zone */
     }
     else {
 	p &= ~(1<<31);
Index: util.c
===================================================================
RCS file: /src/ruby/util.c,v
retrieving revision 1.46
diff -u -r1.46 util.c
--- util.c	21 Sep 2004 03:08:31 -0000	1.46
+++ util.c	29 Apr 2005 09:14:27 -0000
@@ -752,7 +752,7 @@
     int mantSize = 0;		/* Number of digits in mantissa. */
     int hasPoint = FALSE;	/* Decimal point exists. */
     int hasDigit = FALSE;	/* I or F exists. */
-    const char *pMant;		/* Temporarily holds location of mantissa
+    const char *pMant = NULL;	/* Temporarily holds location of mantissa
 				 * in string. */
     const char *pExp;		/* Temporarily holds location of exponent
 				 * in string. */
@@ -782,7 +782,7 @@
      * and also locate the decimal point.
      */
 
-    for ( ; c = *p; p += 1) {
+    for ( ; (c = *p) != '\0'; p += 1) {
 	if (!ISDIGIT(c)) {
 	    if (c != '.' || hasPoint) {
 		break;
Index: variable.c
===================================================================
RCS file: /src/ruby/variable.c,v
retrieving revision 1.120
diff -u -r1.120 variable.c
--- variable.c	4 Mar 2005 06:47:41 -0000	1.120
+++ variable.c	29 Apr 2005 09:14:27 -0000
@@ -340,8 +340,9 @@
     ID id;
 {
     struct global_entry *entry;
+    st_data_t data;
 
-    if (!st_lookup(rb_global_tbl, id, (st_data_t *)&entry)) {
+    if (!st_lookup(rb_global_tbl, id, &data)) {
 	struct global_variable *var;
 	entry = ALLOC(struct global_entry);
 	var = ALLOC(struct global_variable);
@@ -357,6 +358,9 @@
 	var->trace = 0;
 	st_add_direct(rb_global_tbl, id, (st_data_t)entry);
     }
+    else {
+	entry = (struct global_entry *)data;
+    }
     return entry;
 }
 
@@ -632,12 +636,14 @@
     ID id;
     struct global_entry *entry;
     struct trace_var *trace;
+    st_data_t data;
 
     rb_scan_args(argc, argv, "11", &var, &cmd);
     id = rb_to_id(var);
-    if (!st_lookup(rb_global_tbl, id, (st_data_t *)&entry)) {
+    if (!st_lookup(rb_global_tbl, id, &data)) {
 	rb_name_error(id, "undefined global variable %s", rb_id2name(id));
     }
+    entry = (struct global_entry *)data;
 
     trace = entry->var->trace;
     if (NIL_P(cmd)) {
@@ -793,17 +799,18 @@
     ID name2;
 {
     struct global_entry *entry1, *entry2;
+    st_data_t data;
 
     if (rb_safe_level() >= 4)
 	rb_raise(rb_eSecurityError, "Insecure: can't alias global variable");
 
     entry2 = rb_global_entry(name2);
-    if (!st_lookup(rb_global_tbl, name1, (st_data_t *)&entry1)) {
+    if (!st_lookup(rb_global_tbl, name1, &data)) {
 	entry1 = ALLOC(struct global_entry);
 	entry1->id = name1;
 	st_add_direct(rb_global_tbl, name1, (st_data_t)entry1);
     }
-    else if (entry1->var != entry2->var) {
+    else if ((entry1 = (struct global_entry *)data)->var != entry2->var) {
 	struct global_variable *var = entry1->var;
 	if (var->block_trace) {
 	    rb_raise(rb_eRuntimeError, "can't alias in tracer");
@@ -833,12 +840,12 @@
 rb_generic_ivar_table(obj)
     VALUE obj;
 {
-    st_table *tbl;
+    st_data_t tbl;
 
     if (!FL_TEST(obj, FL_EXIVAR)) return 0;
     if (!generic_iv_tbl) return 0;
-    if (!st_lookup(generic_iv_tbl, obj, (st_data_t *)&tbl)) return 0;
-    return tbl;
+    if (!st_lookup(generic_iv_tbl, obj, &tbl)) return 0;
+    return (st_table *)tbl;
 }
 
 static VALUE
@@ -846,15 +853,13 @@
     VALUE obj;
     ID id;
 {
-    st_table *tbl;
-    VALUE val;
-
     if (generic_iv_tbl) {
-      if (st_lookup(generic_iv_tbl, obj, (st_data_t *)&tbl)) {
-	if (st_lookup(tbl, id, &val)) {
-	  return val;
+	st_data_t data;
+	if (st_lookup(generic_iv_tbl, (st_data_t)obj, &data)) {
+	    if (st_lookup((st_table *)data, (st_data_t)id, &data)) {
+		return (VALUE)data;
+	    }
 	}
-      }
     }
 
     rb_warning("instance variable %s not initialized", rb_id2name(id));
@@ -868,6 +873,7 @@
     VALUE val;
 {
     st_table *tbl;
+    st_data_t data;
 
     if (rb_special_const_p(obj)) {
 	special_generic_ivar = 1;
@@ -876,14 +882,14 @@
 	generic_iv_tbl = st_init_numtable();
     }
 
-    if (!st_lookup(generic_iv_tbl, obj, (st_data_t *)&tbl)) {
+    if (!st_lookup(generic_iv_tbl, obj, &data)) {
 	FL_SET(obj, FL_EXIVAR);
 	tbl = st_init_numtable();
 	st_add_direct(generic_iv_tbl, obj, (st_data_t)tbl);
 	st_add_direct(tbl, id, val);
 	return;
     }
-    st_insert(tbl, id, val);
+    st_insert((st_table *)data, id, val);
 }
 
 static VALUE
@@ -891,12 +897,11 @@
     VALUE obj;
     ID id;
 {
-    st_table *tbl;
-    VALUE val;
+    st_data_t tbl, val;
 
     if (!generic_iv_tbl) return Qfalse;
-    if (!st_lookup(generic_iv_tbl, obj, (st_data_t *)&tbl)) return Qfalse;
-    if (st_lookup(tbl, id, &val)) {
+    if (!st_lookup(generic_iv_tbl, obj, &tbl)) return Qfalse;
+    if (st_lookup((st_table *)tbl, id, &val)) {
 	return Qtrue;
     }
     return Qfalse;
@@ -909,13 +914,17 @@
     VALUE *valp;
 {
     st_table *tbl;
+    st_data_t data;
     int status;
 
     if (!generic_iv_tbl) return 0;
-    if (!st_lookup(generic_iv_tbl, obj, (st_data_t *)&tbl)) return 0;
-    status = st_delete(tbl, &id, valp);
+    if (!st_lookup(generic_iv_tbl, obj, &data)) return 0;
+    tbl = (st_table *)data;
+    status = st_delete(tbl, &id, &data);
+    if (valp) *valp = (VALUE)data;
     if (tbl->num_entries == 0) {
-	st_delete(generic_iv_tbl, &obj, (st_data_t *)&tbl);
+	data = (st_data_t)obj;
+	st_delete(generic_iv_tbl, &data, 0);
 	st_free_table(tbl);
     }
     return status;
@@ -925,11 +934,11 @@
 rb_mark_generic_ivar(obj)
     VALUE obj;
 {
-    st_table *tbl;
+    st_data_t tbl;
 
     if (!generic_iv_tbl) return;
-    if (st_lookup(generic_iv_tbl, obj, (st_data_t *)&tbl)) {
-	rb_mark_tbl(tbl);
+    if (st_lookup(generic_iv_tbl, obj, &tbl)) {
+	rb_mark_tbl((st_table *)tbl);
     }
 }
 
@@ -965,26 +974,26 @@
 rb_free_generic_ivar(obj)
     VALUE obj;
 {
-    st_table *tbl;
+    st_data_t tbl;
 
     if (!generic_iv_tbl) return;
-    if (st_delete(generic_iv_tbl, &obj, (st_data_t *)&tbl))
-	st_free_table(tbl);
+    if (st_delete(generic_iv_tbl, &obj, &tbl))
+	st_free_table((st_table *)tbl);
 }
 
 void
 rb_copy_generic_ivar(clone, obj)
     VALUE clone, obj;
 {
+    st_data_t data;
     st_table *tbl;
 
     if (!generic_iv_tbl) return;
     if (!FL_TEST(obj, FL_EXIVAR)) return;
-    if (st_lookup(generic_iv_tbl, obj, (st_data_t *)&tbl)) {
-	st_table *old;
-
-	if (st_lookup(generic_iv_tbl, clone, (st_data_t *)&old)) {
-	    st_free_table(old);
+    if (st_lookup(generic_iv_tbl, obj, &data)) {
+	tbl = (st_table *)data;
+	if (st_lookup(generic_iv_tbl, clone, &data)) {
+	    st_free_table((st_table *)data);
 	    st_insert(generic_iv_tbl, clone, (st_data_t)st_copy(tbl));
 	}
 	else {
@@ -1127,10 +1136,10 @@
       default:
 	if (!generic_iv_tbl) break;
 	if (FL_TEST(obj, FL_EXIVAR) || rb_special_const_p(obj)) {
-	    st_table *tbl;
+	    st_data_t tbl;
 
-	    if (st_lookup(generic_iv_tbl, obj, (st_data_t *)&tbl)) {
-		st_foreach_safe(tbl, ivar_i, ary);
+	    if (st_lookup(generic_iv_tbl, obj, &tbl)) {
+		st_foreach_safe((st_table *)tbl, ivar_i, ary);
 	    }
 	}
 	break;
@@ -1338,7 +1347,7 @@
     NODE *load = autoload_delete(klass, id);
 
     if (!load || !(file = load->nd_lit) || rb_provided(RSTRING(file)->ptr)) {
-	const_missing(klass, id);
+	file = const_missing(klass, id);
     }
     rb_require_safe(file, load->nd_nth);
 }

In This Thread