Hi,

At Thu, 11 Dec 2003 00:39:35 +0900,
Daniel Berger wrote:
> > Do you know where alloca() is declared?
> 
> In alloca.h.  I think the relevant thread is ruby-talk 55208.  Although
> that thread refers to FXRuby, I suspect it's the same issue in core
> Ruby.

In ruby.h, alloca.h was ignored for GCC.


Index: configure.in =================================================================== RCS file: /cvs/ruby/src/ruby/configure.in,v retrieving revision 1.203 diff -u -2 -p -d -r1.203 configure.in --- configure.in 6 Dec 2003 12:48:51 -0000 1.203 +++ configure.in 10 Dec 2003 16:18:44 -0000 @@ -365,5 +365,5 @@ AC_CHECK_HEADERS(stdlib.h string.h unist fcntl.h sys/fcntl.h sys/select.h sys/time.h sys/times.h sys/param.h\ syscall.h pwd.h grp.h a.out.h utime.h memory.h direct.h sys/resource.h \ - sys/mkdev.h sys/utime.h netinet/in_systm.h float.h pthread.h) + sys/mkdev.h sys/utime.h netinet/in_systm.h float.h ieeefp.h pthread.h) dnl Checks for typedefs, structures, and compiler characteristics. Index: file.c =================================================================== RCS file: /cvs/ruby/src/ruby/file.c,v retrieving revision 1.164 diff -u -2 -p -d -r1.164 file.c --- file.c 28 Nov 2003 14:23:31 -0000 1.164 +++ file.c 10 Dec 2003 16:10:46 -0000 @@ -327,5 +327,5 @@ rb_stat_inspect(self) char buf[32]; - sprintf(buf, "0%o", NUM2INT(v)); + sprintf(buf, "0%lo", NUM2ULONG(v)); rb_str_buf_cat2(str, buf); } Index: numeric.c =================================================================== RCS file: /cvs/ruby/src/ruby/numeric.c,v retrieving revision 1.97 diff -u -2 -p -d -r1.97 numeric.c --- numeric.c 1 Dec 2003 13:16:06 -0000 1.97 +++ numeric.c 10 Dec 2003 16:19:07 -0000 @@ -24,4 +24,8 @@ #endif +#ifdef HAVE_IEEEFP_H +#include <ieeefp.h> +#endif + /* use IEEE 64bit values if not defined */ #ifndef FLT_RADIX Index: parse.y =================================================================== RCS file: /cvs/ruby/src/ruby/parse.y,v retrieving revision 1.305 diff -u -2 -p -d -r1.305 parse.y --- parse.y 4 Dec 2003 07:41:20 -0000 1.305 +++ parse.y 10 Dec 2003 10:20:31 -0000 @@ -5444,5 +5444,5 @@ arg_prepend(node1, node2) NODE *node1, *node2; { - switch (nodetype(node2)) { + switch (nd_type(node2)) { case NODE_ARRAY: return list_concat(NEW_LIST(node1), node2); @@ -5456,5 +5456,5 @@ arg_prepend(node1, node2) default: - rb_bug("unknown nodetype(%d) for arg_prepend", nodetype(node2)); + rb_bug("unknown nodetype(%d) for arg_prepend", nd_type(node2)); } return 0; /* not reached */ Index: ruby.h =================================================================== RCS file: /cvs/ruby/src/ruby/ruby.h,v retrieving revision 1.95 diff -u -2 -p -d -r1.95 ruby.h --- ruby.h 1 Dec 2003 08:42:53 -0000 1.95 +++ ruby.h 10 Dec 2003 16:30:04 -0000 @@ -37,14 +37,14 @@ extern "C" { /* need to include <ctype.h> to use these macros */ #ifndef ISPRINT -#define ISASCII(c) isascii((unsigned char)(c)) +#define ISASCII(c) isascii((int)(unsigned char)(c)) #undef ISPRINT -#define ISPRINT(c) (ISASCII(c) && isprint((unsigned char)(c))) -#define ISSPACE(c) (ISASCII(c) && isspace((unsigned char)(c))) -#define ISUPPER(c) (ISASCII(c) && isupper((unsigned char)(c))) -#define ISLOWER(c) (ISASCII(c) && islower((unsigned char)(c))) -#define ISALNUM(c) (ISASCII(c) && isalnum((unsigned char)(c))) -#define ISALPHA(c) (ISASCII(c) && isalpha((unsigned char)(c))) -#define ISDIGIT(c) (ISASCII(c) && isdigit((unsigned char)(c))) -#define ISXDIGIT(c) (ISASCII(c) && isxdigit((unsigned char)(c))) +#define ISPRINT(c) (ISASCII(c) && isprint((int)(unsigned char)(c))) +#define ISSPACE(c) (ISASCII(c) && isspace((int)(unsigned char)(c))) +#define ISUPPER(c) (ISASCII(c) && isupper((int)(unsigned char)(c))) +#define ISLOWER(c) (ISASCII(c) && islower((int)(unsigned char)(c))) +#define ISALNUM(c) (ISASCII(c) && isalnum((int)(unsigned char)(c))) +#define ISALPHA(c) (ISASCII(c) && isalpha((int)(unsigned char)(c))) +#define ISDIGIT(c) (ISASCII(c) && isdigit((int)(unsigned char)(c))) +#define ISXDIGIT(c) (ISASCII(c) && isxdigit((int)(unsigned char)(c))) #endif @@ -54,5 +54,5 @@ extern "C" { #endif -#if defined(HAVE_ALLOCA_H) && !defined(__GNUC__) +#if defined(HAVE_ALLOCA_H) #include <alloca.h> #endif Index: ext/bigdecimal/bigdecimal.c =================================================================== RCS file: /cvs/ruby/src/ruby/ext/bigdecimal/bigdecimal.c,v retrieving revision 1.38 diff -u -2 -p -d -r1.38 bigdecimal.c --- ext/bigdecimal/bigdecimal.c 21 Oct 2003 03:29:54 -0000 1.38 +++ ext/bigdecimal/bigdecimal.c 10 Dec 2003 16:14:13 -0000 @@ -104,5 +104,5 @@ GetVpValue(VALUE v, int must) break; case T_FIXNUM: - sprintf(szD, "%d", FIX2INT(v)); + sprintf(szD, "%ld", FIX2LONG(v)); return VpCreateRbObject(VpBaseFig() * 2 + 1, szD); @@ -147,7 +147,6 @@ BigDecimal_prec(VALUE self) GUARD_OBJ(p,GetVpValue(self,1)); - obj = rb_ary_new(); - obj = rb_ary_push(obj,INT2NUM(p->Prec*VpBaseFig())); - obj = rb_ary_push(obj,INT2NUM(p->MaxPrec*VpBaseFig())); + obj = rb_assoc_new(INT2NUM(p->Prec*VpBaseFig()), + INT2NUM(p->MaxPrec*VpBaseFig())); return obj; } @@ -428,12 +427,8 @@ BigDecimal_coerce(VALUE self, VALUE othe Real *b; if(TYPE(other) == T_FLOAT) { - obj = rb_ary_new(); - obj = rb_ary_push(obj,other); - obj = rb_ary_push(obj,BigDecimal_to_f(self)); + obj = rb_assoc_new(other, BigDecimal_to_f(self)); } else { GUARD_OBJ(b,GetVpValue(other,1)); - obj = rb_ary_new(); - obj = rb_ary_push(obj, b->obj); - obj = rb_ary_push(obj, self); + obj = rb_assoc_new(b->obj, self); } return obj; @@ -781,7 +776,5 @@ BigDecimal_divmod(VALUE self, VALUE r) if(obj!=(VALUE)0) return obj; SAVE(div);SAVE(mod); - obj = rb_ary_new(); - rb_ary_push(obj, ToValue(div)); - rb_ary_push(obj, ToValue(mod)); + obj = rb_assoc_new(ToValue(div), ToValue(mod)); return obj; } @@ -1125,5 +1118,5 @@ BigDecimal_split(VALUE self) e = VpExponent10(vp); obj1 = rb_str_new2(psz1); - obj = rb_ary_new(); + obj = rb_ary_new2(4); rb_ary_push(obj, INT2FIX(s)); rb_ary_push(obj, obj1); Index: ext/dl/sym.c =================================================================== RCS file: /cvs/ruby/src/ruby/ext/dl/sym.c,v retrieving revision 1.23 diff -u -2 -p -d -r1.23 sym.c --- ext/dl/sym.c 4 Dec 2003 01:45:07 -0000 1.23 +++ ext/dl/sym.c 9 Dec 2003 00:46:01 -0000 @@ -363,5 +363,5 @@ static int rb_dlsym_guardcall(char type, ANY_TYPE *ret, long *stack, void *func) { - volatile char *guard = ALLOCA_N(char, 1); /* guard stack pointer */ + char *volatile guard = ALLOCA_N(char, 1); /* guard stack pointer */ switch(type){ case '0': Index: ext/iconv/iconv.c =================================================================== RCS file: /cvs/ruby/src/ruby/ext/iconv/iconv.c,v retrieving revision 1.14 diff -u -2 -p -d -r1.14 iconv.c --- ext/iconv/iconv.c 10 Dec 2003 08:26:34 -0000 1.14 +++ ext/iconv/iconv.c 10 Dec 2003 16:15:46 -0000 @@ -427,5 +427,5 @@ iconv_convert else { /* Some iconv() have a bug, return *outlen out of range */ - sprintf(errmsg, "bug?(output length = %ld)", sizeof(buffer) - outlen); + sprintf(errmsg, "bug?(output length = %ld)", (long)(sizeof(buffer) - outlen)); error = rb_eIconvOutOfRange; } Index: ext/pty/pty.c =================================================================== RCS file: /cvs/ruby/src/ruby/ext/pty/pty.c,v retrieving revision 1.18 diff -u -2 -p -d -r1.18 pty.c --- ext/pty/pty.c 10 Dec 2003 05:50:12 -0000 1.18 +++ ext/pty/pty.c 10 Dec 2003 07:08:34 -0000 @@ -39,5 +39,5 @@ #if !defined(HAVE_OPENPTY) -#ifdef __hpux +#if defined(__hpux) static char *MasterDevice = "/dev/ptym/pty%s", @@ -62,6 +62,5 @@ char *MasterDevice = "/dev/ptym/pty%s", 0, }; -#else /* NOT HPUX */ -#ifdef _IBMESA /* AIX/ESA */ +#elif defined(_IBMESA) /* AIX/ESA */ static char *MasterDevice = "/dev/ptyp%s", @@ -85,5 +84,5 @@ char *MasterDevice = "/dev/ptyp%s", "f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff", }; -#else +#elif !defined(HAVE_PTSNAME) static char *MasterDevice = "/dev/pty%s", @@ -100,6 +99,5 @@ char *MasterDevice = "/dev/pty%s", 0, }; -#endif /* _IBMESA */ -#endif /* HPUX */ +#endif #endif /* !defined(HAVE_OPENPTY) */ @@ -343,7 +341,5 @@ getDevice(master,slave) int *master,*slave; { - char **p; int i,j; - char MasterName[DEVICELEN]; #ifdef HAVE_PTSNAME @@ -382,4 +378,7 @@ getDevice(master,slave) rb_raise(rb_eRuntimeError, "Cannot get Master/Slave device"); #else + char **p; + char MasterName[DEVICELEN]; + for (p = deviceNo; *p != NULL; p++) { sprintf(MasterName,MasterDevice,*p); Index: ext/socket/socket.c =================================================================== RCS file: /cvs/ruby/src/ruby/ext/socket/socket.c,v retrieving revision 1.106 diff -u -2 -p -d -r1.106 socket.c --- ext/socket/socket.c 22 Nov 2003 03:59:33 -0000 1.106 +++ ext/socket/socket.c 10 Dec 2003 16:17:15 -0000 @@ -597,5 +597,5 @@ port_str(port, pbuf, len) } else if (FIXNUM_P(port)) { - snprintf(pbuf, len, "%d", FIX2INT(port)); + snprintf(pbuf, len, "%ld", FIX2LONG(port)); return pbuf; } @@ -894,5 +894,5 @@ init_inetsock_internal(arg) int type = arg->type; struct addrinfo *res; - int fd, status; + int fd, status = 0; char *syscall; @@ -2107,5 +2107,5 @@ sock_s_getaddrinfo(argc, argv) } else if (FIXNUM_P(port)) { - snprintf(pbuf, sizeof(pbuf), "%d", FIX2INT(port)); + snprintf(pbuf, sizeof(pbuf), "%ld", FIX2LONG(port)); pptr = pbuf; } @@ -2226,5 +2226,5 @@ sock_s_getnameinfo(argc, argv) } else if (FIXNUM_P(port)) { - snprintf(pbuf, sizeof(pbuf), "%d", NUM2INT(port)); + snprintf(pbuf, sizeof(pbuf), "%ld", NUM2LONG(port)); pptr = pbuf; } Index: ext/syck/rubyext.c =================================================================== RCS file: /cvs/ruby/src/ruby/ext/syck/rubyext.c,v retrieving revision 1.28 diff -u -2 -p -d -r1.28 rubyext.c --- ext/syck/rubyext.c 25 Nov 2003 19:51:38 -0000 1.28 +++ ext/syck/rubyext.c 9 Dec 2003 01:27:18 -0000 @@ -73,4 +73,5 @@ void rb_syck_err_handler _((SyckParser * SyckNode * rb_syck_bad_anchor_handler _((SyckParser *, char *)); void rb_syck_output_handler _((SyckEmitter *, char *, long)); +int syck_parser_assign_io _((SyckParser *, VALUE)); struct parser_xtra { @@ -205,25 +206,25 @@ rb_syck_mktime(str) /* Month*/ ptr += 4; - while ( !isdigit( *ptr ) ) ptr++; + while ( !ISDIGIT( *ptr ) ) ptr++; mon = INT2FIX(strtol(ptr, NULL, 10)); /* Day*/ ptr += 2; - while ( !isdigit( *ptr ) ) ptr++; + while ( !ISDIGIT( *ptr ) ) ptr++; day = INT2FIX(strtol(ptr, NULL, 10)); /* Hour*/ ptr += 2; - while ( !isdigit( *ptr ) ) ptr++; + while ( !ISDIGIT( *ptr ) ) ptr++; hour = INT2FIX(strtol(ptr, NULL, 10)); /* Minute */ ptr += 2; - while ( !isdigit( *ptr ) ) ptr++; + while ( !ISDIGIT( *ptr ) ) ptr++; min = INT2FIX(strtol(ptr, NULL, 10)); /* Second */ ptr += 2; - while ( !isdigit( *ptr ) ) ptr++; + while ( !ISDIGIT( *ptr ) ) ptr++; sec = INT2FIX(strtol(ptr, NULL, 10)); @@ -486,10 +487,10 @@ yaml_org_handler( n, ref ) /* Month*/ ptr += 4; - while ( !isdigit( *ptr ) ) ptr++; + while ( !ISDIGIT( *ptr ) ) ptr++; mon = INT2FIX(strtol(ptr, NULL, 10)); /* Day*/ ptr += 2; - while ( !isdigit( *ptr ) ) ptr++; + while ( !ISDIGIT( *ptr ) ) ptr++; day = INT2FIX(strtol(ptr, NULL, 10));
-- Nobu Nakada