1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* suppress warnings on cygwin, mingw and mswin.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16740 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2008-06-01 19:55:25 +00:00
parent 5397015d2e
commit 7c5e3348f7
10 changed files with 61 additions and 42 deletions

View file

@ -1,3 +1,7 @@
Mon Jun 2 04:55:05 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
* suppress warnings on cygwin, mingw and mswin.
Mon Jun 2 04:35:32 2008 NARUSE, Yui <naruse@ruby-lang.org> Mon Jun 2 04:35:32 2008 NARUSE, Yui <naruse@ruby-lang.org>
* enc/gb18030.c (gb18030_code_to_mbc): add 0x80000000 * enc/gb18030.c (gb18030_code_to_mbc): add 0x80000000

View file

@ -503,6 +503,7 @@ enc_capable(VALUE obj)
} }
} }
#if 0
static void static void
enc_check_capable(VALUE x) enc_check_capable(VALUE x)
{ {
@ -527,6 +528,7 @@ enc_check_capable(VALUE x)
rb_raise(rb_eTypeError, "wrong argument type %s (not encode capable)", etype); rb_raise(rb_eTypeError, "wrong argument type %s (not encode capable)", etype);
} }
} }
#endif
ID ID
rb_id_encoding(void) rb_id_encoding(void)

18
file.c
View file

@ -2614,7 +2614,7 @@ file_expand_path(VALUE fname, VALUE dname, VALUE result)
if (s[0] == '~') { if (s[0] == '~') {
if (isdirsep(s[1]) || s[1] == '\0') { if (isdirsep(s[1]) || s[1] == '\0') {
char *dir = getenv("HOME"); const char *dir = getenv("HOME");
if (!dir) { if (!dir) {
rb_raise(rb_eArgError, "couldn't find HOME environment -- expanding `%s'", s); rb_raise(rb_eArgError, "couldn't find HOME environment -- expanding `%s'", s);
@ -2973,9 +2973,9 @@ static VALUE
rb_file_s_basename(int argc, VALUE *argv) rb_file_s_basename(int argc, VALUE *argv)
{ {
VALUE fname, fext, basename; VALUE fname, fext, basename;
char *name, *p; const char *name, *p;
#if defined DOSISH_DRIVE_LETTER || defined DOSISH_UNC #if defined DOSISH_DRIVE_LETTER || defined DOSISH_UNC
char *root; const char *root;
#endif #endif
int f, n; int f, n;
@ -3202,7 +3202,7 @@ rb_file_join(VALUE ary, VALUE sep)
{ {
long len, i; long len, i;
VALUE result, tmp; VALUE result, tmp;
char *name, *tail; const char *name, *tail;
if (RARRAY_LEN(ary) == 0) return rb_str_new(0, 0); if (RARRAY_LEN(ary) == 0) return rb_str_new(0, 0);
@ -4368,7 +4368,7 @@ static int
path_check_0(VALUE path, int execpath) path_check_0(VALUE path, int execpath)
{ {
struct stat st; struct stat st;
char *p0 = StringValueCStr(path); const char *p0 = StringValueCStr(path);
char *p = 0, *s; char *p = 0, *s;
if (!is_absolute_path(p0)) { if (!is_absolute_path(p0)) {
@ -4462,8 +4462,8 @@ VALUE rb_get_load_path(void);
int int
rb_find_file_ext(VALUE *filep, const char *const *ext) rb_find_file_ext(VALUE *filep, const char *const *ext)
{ {
char *path, *found; const char *path, *found;
char *f = RSTRING_PTR(*filep); const char *f = RSTRING_PTR(*filep);
VALUE fname, load_path; VALUE fname, load_path;
long i, j; long i, j;
@ -4519,8 +4519,8 @@ VALUE
rb_find_file(VALUE path) rb_find_file(VALUE path)
{ {
VALUE tmp, load_path; VALUE tmp, load_path;
char *f = StringValueCStr(path); const char *f = StringValueCStr(path);
char *lpath; const char *lpath;
char fbuf[MAXPATHLEN]; char fbuf[MAXPATHLEN];
if (f[0] == '~') { if (f[0] == '~') {

View file

@ -546,6 +546,7 @@ size_t rb_w32_read(int, void *, size_t);
size_t rb_w32_write(int, const void *, size_t); size_t rb_w32_write(int, const void *, size_t);
int rb_w32_utime(const char *, const struct utimbuf *); int rb_w32_utime(const char *, const struct utimbuf *);
int WINAPI rb_w32_Sleep(unsigned long msec); int WINAPI rb_w32_Sleep(unsigned long msec);
int rb_w32_wait_events_blocking(HANDLE *events, int num, DWORD timeout);
/* /*
== ***CAUTION*** == ***CAUTION***

1
iseq.c
View file

@ -1300,6 +1300,7 @@ Init_ISeq(void)
/* disable this feature because there is no verifier. */ /* disable this feature because there is no verifier. */
/* rb_define_singleton_method(rb_cISeq, "load", iseq_s_load, -1); */ /* rb_define_singleton_method(rb_cISeq, "load", iseq_s_load, -1); */
(void)iseq_s_load;
rb_define_singleton_method(rb_cISeq, "compile", iseq_s_compile, -1); rb_define_singleton_method(rb_cISeq, "compile", iseq_s_compile, -1);
rb_define_singleton_method(rb_cISeq, "new", iseq_s_compile, -1); rb_define_singleton_method(rb_cISeq, "new", iseq_s_compile, -1);

View file

@ -107,13 +107,15 @@ static char sccsid[] = "@(#)crypt.c 8.1 (Berkeley) 6/4/93";
#define LARGEDATA #define LARGEDATA
#endif #endif
int des_setkey(), des_cipher();
/* compile with "-DSTATIC=int" when profiling */ /* compile with "-DSTATIC=int" when profiling */
#ifndef STATIC #ifndef STATIC
#define STATIC static #define STATIC static
#endif #endif
STATIC init_des(), init_perm(), permute(); STATIC void init_des(), init_perm(), permute();
#ifdef DEBUG #ifdef DEBUG
STATIC prtab(); STATIC void prtab();
#endif #endif
/* ==================================== */ /* ==================================== */
@ -299,7 +301,7 @@ typedef union {
#define PERM3264(d,d0,d1,cpp,p) \ #define PERM3264(d,d0,d1,cpp,p) \
{ C_block tblk; permute(cpp,&tblk,p,4); LOAD (d,d0,d1,tblk); } { C_block tblk; permute(cpp,&tblk,p,4); LOAD (d,d0,d1,tblk); }
STATIC STATIC void
permute(cp, out, p, chars_in) permute(cp, out, p, chars_in)
unsigned char *cp; unsigned char *cp;
C_block *out; C_block *out;
@ -377,46 +379,62 @@ static unsigned char PC2[] = { /* permuted choice table 2 */
}; };
static unsigned char S[8][64] = { /* 48->32 bit substitution tables */ static unsigned char S[8][64] = { /* 48->32 bit substitution tables */
{
/* S[1] */ /* S[1] */
14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12, 5, 9, 0, 7, 14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12, 5, 9, 0, 7,
0, 15, 7, 4, 14, 2, 13, 1, 10, 6, 12, 11, 9, 5, 3, 8, 0, 15, 7, 4, 14, 2, 13, 1, 10, 6, 12, 11, 9, 5, 3, 8,
4, 1, 14, 8, 13, 6, 2, 11, 15, 12, 9, 7, 3, 10, 5, 0, 4, 1, 14, 8, 13, 6, 2, 11, 15, 12, 9, 7, 3, 10, 5, 0,
15, 12, 8, 2, 4, 9, 1, 7, 5, 11, 3, 14, 10, 0, 6, 13, 15, 12, 8, 2, 4, 9, 1, 7, 5, 11, 3, 14, 10, 0, 6, 13,
},
{
/* S[2] */ /* S[2] */
15, 1, 8, 14, 6, 11, 3, 4, 9, 7, 2, 13, 12, 0, 5, 10, 15, 1, 8, 14, 6, 11, 3, 4, 9, 7, 2, 13, 12, 0, 5, 10,
3, 13, 4, 7, 15, 2, 8, 14, 12, 0, 1, 10, 6, 9, 11, 5, 3, 13, 4, 7, 15, 2, 8, 14, 12, 0, 1, 10, 6, 9, 11, 5,
0, 14, 7, 11, 10, 4, 13, 1, 5, 8, 12, 6, 9, 3, 2, 15, 0, 14, 7, 11, 10, 4, 13, 1, 5, 8, 12, 6, 9, 3, 2, 15,
13, 8, 10, 1, 3, 15, 4, 2, 11, 6, 7, 12, 0, 5, 14, 9, 13, 8, 10, 1, 3, 15, 4, 2, 11, 6, 7, 12, 0, 5, 14, 9,
},
{
/* S[3] */ /* S[3] */
10, 0, 9, 14, 6, 3, 15, 5, 1, 13, 12, 7, 11, 4, 2, 8, 10, 0, 9, 14, 6, 3, 15, 5, 1, 13, 12, 7, 11, 4, 2, 8,
13, 7, 0, 9, 3, 4, 6, 10, 2, 8, 5, 14, 12, 11, 15, 1, 13, 7, 0, 9, 3, 4, 6, 10, 2, 8, 5, 14, 12, 11, 15, 1,
13, 6, 4, 9, 8, 15, 3, 0, 11, 1, 2, 12, 5, 10, 14, 7, 13, 6, 4, 9, 8, 15, 3, 0, 11, 1, 2, 12, 5, 10, 14, 7,
1, 10, 13, 0, 6, 9, 8, 7, 4, 15, 14, 3, 11, 5, 2, 12, 1, 10, 13, 0, 6, 9, 8, 7, 4, 15, 14, 3, 11, 5, 2, 12,
},
{
/* S[4] */ /* S[4] */
7, 13, 14, 3, 0, 6, 9, 10, 1, 2, 8, 5, 11, 12, 4, 15, 7, 13, 14, 3, 0, 6, 9, 10, 1, 2, 8, 5, 11, 12, 4, 15,
13, 8, 11, 5, 6, 15, 0, 3, 4, 7, 2, 12, 1, 10, 14, 9, 13, 8, 11, 5, 6, 15, 0, 3, 4, 7, 2, 12, 1, 10, 14, 9,
10, 6, 9, 0, 12, 11, 7, 13, 15, 1, 3, 14, 5, 2, 8, 4, 10, 6, 9, 0, 12, 11, 7, 13, 15, 1, 3, 14, 5, 2, 8, 4,
3, 15, 0, 6, 10, 1, 13, 8, 9, 4, 5, 11, 12, 7, 2, 14, 3, 15, 0, 6, 10, 1, 13, 8, 9, 4, 5, 11, 12, 7, 2, 14,
},
{
/* S[5] */ /* S[5] */
2, 12, 4, 1, 7, 10, 11, 6, 8, 5, 3, 15, 13, 0, 14, 9, 2, 12, 4, 1, 7, 10, 11, 6, 8, 5, 3, 15, 13, 0, 14, 9,
14, 11, 2, 12, 4, 7, 13, 1, 5, 0, 15, 10, 3, 9, 8, 6, 14, 11, 2, 12, 4, 7, 13, 1, 5, 0, 15, 10, 3, 9, 8, 6,
4, 2, 1, 11, 10, 13, 7, 8, 15, 9, 12, 5, 6, 3, 0, 14, 4, 2, 1, 11, 10, 13, 7, 8, 15, 9, 12, 5, 6, 3, 0, 14,
11, 8, 12, 7, 1, 14, 2, 13, 6, 15, 0, 9, 10, 4, 5, 3, 11, 8, 12, 7, 1, 14, 2, 13, 6, 15, 0, 9, 10, 4, 5, 3,
},
{
/* S[6] */ /* S[6] */
12, 1, 10, 15, 9, 2, 6, 8, 0, 13, 3, 4, 14, 7, 5, 11, 12, 1, 10, 15, 9, 2, 6, 8, 0, 13, 3, 4, 14, 7, 5, 11,
10, 15, 4, 2, 7, 12, 9, 5, 6, 1, 13, 14, 0, 11, 3, 8, 10, 15, 4, 2, 7, 12, 9, 5, 6, 1, 13, 14, 0, 11, 3, 8,
9, 14, 15, 5, 2, 8, 12, 3, 7, 0, 4, 10, 1, 13, 11, 6, 9, 14, 15, 5, 2, 8, 12, 3, 7, 0, 4, 10, 1, 13, 11, 6,
4, 3, 2, 12, 9, 5, 15, 10, 11, 14, 1, 7, 6, 0, 8, 13, 4, 3, 2, 12, 9, 5, 15, 10, 11, 14, 1, 7, 6, 0, 8, 13,
},
{
/* S[7] */ /* S[7] */
4, 11, 2, 14, 15, 0, 8, 13, 3, 12, 9, 7, 5, 10, 6, 1, 4, 11, 2, 14, 15, 0, 8, 13, 3, 12, 9, 7, 5, 10, 6, 1,
13, 0, 11, 7, 4, 9, 1, 10, 14, 3, 5, 12, 2, 15, 8, 6, 13, 0, 11, 7, 4, 9, 1, 10, 14, 3, 5, 12, 2, 15, 8, 6,
1, 4, 11, 13, 12, 3, 7, 14, 10, 15, 6, 8, 0, 5, 9, 2, 1, 4, 11, 13, 12, 3, 7, 14, 10, 15, 6, 8, 0, 5, 9, 2,
6, 11, 13, 8, 1, 4, 10, 7, 9, 5, 0, 15, 14, 2, 3, 12, 6, 11, 13, 8, 1, 4, 10, 7, 9, 5, 0, 15, 14, 2, 3, 12,
},
{
/* S[8] */ /* S[8] */
13, 2, 8, 4, 6, 15, 11, 1, 10, 9, 3, 14, 5, 0, 12, 7, 13, 2, 8, 4, 6, 15, 11, 1, 10, 9, 3, 14, 5, 0, 12, 7,
1, 15, 13, 8, 10, 3, 7, 4, 12, 5, 6, 11, 0, 14, 9, 2, 1, 15, 13, 8, 10, 3, 7, 4, 12, 5, 6, 11, 0, 14, 9, 2,
7, 11, 4, 1, 9, 12, 14, 2, 0, 6, 10, 13, 15, 3, 5, 8, 7, 11, 4, 1, 9, 12, 14, 2, 0, 6, 10, 13, 15, 3, 5, 8,
2, 1, 14, 7, 4, 10, 8, 13, 15, 12, 9, 0, 3, 5, 6, 11, 2, 1, 14, 7, 4, 10, 8, 13, 15, 12, 9, 0, 3, 5, 6, 11,
},
}; };
static unsigned char P32Tr[] = { /* 32-bit permutation function */ static unsigned char P32Tr[] = { /* 32-bit permutation function */
@ -580,6 +598,7 @@ static C_block KS[KS_SIZE];
/* /*
* Set up the key schedule from the key. * Set up the key schedule from the key.
*/ */
int
des_setkey(key) des_setkey(key)
register const char *key; register const char *key;
{ {
@ -614,6 +633,7 @@ des_setkey(key)
* NOTE: the performance of this routine is critically dependent on your * NOTE: the performance of this routine is critically dependent on your
* compiler and machine architecture. * compiler and machine architecture.
*/ */
int
des_cipher(in, out, salt, num_iter) des_cipher(in, out, salt, num_iter)
const char *in; const char *in;
char *out; char *out;
@ -734,7 +754,7 @@ des_cipher(in, out, salt, num_iter)
* Initialize various tables. This need only be done once. It could even be * Initialize various tables. This need only be done once. It could even be
* done at compile time, if the compiler were capable of that sort of thing. * done at compile time, if the compiler were capable of that sort of thing.
*/ */
STATIC STATIC void
init_des() init_des()
{ {
register int i, j; register int i, j;
@ -878,7 +898,7 @@ init_des()
* *
* "perm" must be all-zeroes on entry to this routine. * "perm" must be all-zeroes on entry to this routine.
*/ */
STATIC STATIC void
init_perm(perm, p, chars_in, chars_out) init_perm(perm, p, chars_in, chars_out)
C_block perm[64/CHUNKBITS][1<<CHUNKBITS]; C_block perm[64/CHUNKBITS][1<<CHUNKBITS];
unsigned char p[64]; unsigned char p[64];
@ -902,6 +922,7 @@ init_perm(perm, p, chars_in, chars_out)
/* /*
* "setkey" routine (for backwards compatibility) * "setkey" routine (for backwards compatibility)
*/ */
int
setkey(key) setkey(key)
register const char *key; register const char *key;
{ {
@ -922,6 +943,7 @@ setkey(key)
/* /*
* "encrypt" routine (for backwards compatibility) * "encrypt" routine (for backwards compatibility)
*/ */
int
encrypt(block, flag) encrypt(block, flag)
register char *block; register char *block;
int flag; int flag;
@ -950,7 +972,7 @@ encrypt(block, flag)
} }
#ifdef DEBUG #ifdef DEBUG
STATIC STATIC void
prtab(s, t, num_rows) prtab(s, t, num_rows)
char *s; char *s;
unsigned char *t; unsigned char *t;

View file

@ -3256,6 +3256,9 @@ Init_Thread(void)
} }
rb_thread_create_timer_thread(); rb_thread_create_timer_thread();
(void)native_mutex_trylock;
(void)ruby_thread_set_native;
} }
int int

7
time.c
View file

@ -333,7 +333,7 @@ time_s_at(int argc, VALUE *argv, VALUE klass)
return t; return t;
} }
static const char const months[][4] = { static const char months[][4] = {
"jan", "feb", "mar", "apr", "may", "jun", "jan", "feb", "mar", "apr", "may", "jun",
"jul", "aug", "sep", "oct", "nov", "dec", "jul", "aug", "sep", "oct", "nov", "dec",
}; };
@ -829,7 +829,10 @@ static time_t
make_time_t(struct tm *tptr, int utc_p) make_time_t(struct tm *tptr, int utc_p)
{ {
time_t t; time_t t;
struct tm *tmp, buf; #ifdef NEGATIVE_TIME_T
struct tm *tmp;
#endif
struct tm buf;
buf = *tptr; buf = *tptr;
if (utc_p) { if (utc_p) {
#if defined(HAVE_TIMEGM) #if defined(HAVE_TIMEGM)

5
vm.c
View file

@ -1600,7 +1600,6 @@ extern VALUE *rb_gc_register_stack_start;
#endif #endif
/* debug functions */ /* debug functions */
#if VMDEBUG
static VALUE static VALUE
sdr(void) sdr(void)
@ -1632,7 +1631,6 @@ nsdr(void)
#endif #endif
return ary; return ary;
} }
#endif
void void
Init_VM(void) Init_VM(void)
@ -1692,6 +1690,9 @@ Init_VM(void)
#if VMDEBUG #if VMDEBUG
rb_define_singleton_method(rb_cVM, "SDR", sdr, 0); rb_define_singleton_method(rb_cVM, "SDR", sdr, 0);
rb_define_singleton_method(rb_cVM, "NSDR", nsdr, 0); rb_define_singleton_method(rb_cVM, "NSDR", nsdr, 0);
#else
(void)sdr;
(void)nsdr;
#endif #endif
/* VM bootstrap: phase 2 */ /* VM bootstrap: phase 2 */

View file

@ -21,6 +21,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <errno.h> #include <errno.h>
#include <assert.h> #include <assert.h>
#include <ctype.h>
#include <windows.h> #include <windows.h>
#include <winbase.h> #include <winbase.h>
@ -189,7 +190,7 @@ rb_w32_map_errno(DWORD winerr)
#define map_errno rb_w32_map_errno #define map_errno rb_w32_map_errno
static char *NTLoginName; static const char *NTLoginName;
#ifdef WIN95 #ifdef WIN95
static DWORD Win32System = (DWORD)-1; static DWORD Win32System = (DWORD)-1;
@ -419,10 +420,6 @@ exit_handler(void)
void void
rb_w32_sysinit(int *argc, char ***argv) rb_w32_sysinit(int *argc, char ***argv)
{ {
WORD version;
int ret;
#if _MSC_VER >= 1400 #if _MSC_VER >= 1400
static void set_pioinfo_extra(void); static void set_pioinfo_extra(void);
@ -461,7 +458,7 @@ rb_w32_sysinit(int *argc, char ***argv)
char * char *
getlogin(void) getlogin(void)
{ {
return NTLoginName; return (char *)NTLoginName;
} }
#define MAXCHILDNUM 256 /* max num of child processes */ #define MAXCHILDNUM 256 /* max num of child processes */
@ -476,15 +473,6 @@ static struct ChildRecord {
for (v = ChildRecord; v < ChildRecord + sizeof(ChildRecord) / sizeof(ChildRecord[0]); ++v) for (v = ChildRecord; v < ChildRecord + sizeof(ChildRecord) / sizeof(ChildRecord[0]); ++v)
#define END_FOREACH_CHILD } while (0) #define END_FOREACH_CHILD } while (0)
static struct ChildRecord *
FindFirstChildSlot(void)
{
FOREACH_CHILD(child) {
if (child->pid) return child;
} END_FOREACH_CHILD;
return NULL;
}
static struct ChildRecord * static struct ChildRecord *
FindChildSlot(rb_pid_t pid) FindChildSlot(rb_pid_t pid)
{ {
@ -715,8 +703,6 @@ rb_w32_pipe_exec(const char *cmd, const char *prog, int mode, int *pipe, int *wr
HANDLE hCurProc; HANDLE hCurProc;
SECURITY_ATTRIBUTES sa; SECURITY_ATTRIBUTES sa;
BOOL reading, writing; BOOL reading, writing;
SOCKET pair[2];
int fd;
int binmode; int binmode;
int ret; int ret;
@ -1145,7 +1131,7 @@ skipspace(char *ptr)
int int
rb_w32_cmdvector(const char *cmd, char ***vec) rb_w32_cmdvector(const char *cmd, char ***vec)
{ {
int cmdlen, globbing, len, i; int globbing, len;
int elements, strsz, done; int elements, strsz, done;
int slashes, escape; int slashes, escape;
char *ptr, *base, *buffer, *cmdline; char *ptr, *base, *buffer, *cmdline;
@ -2694,7 +2680,6 @@ rb_w32_getservbyport(int port, const char *proto)
static int static int
socketpair_internal(int af, int type, int protocol, SOCKET *sv) socketpair_internal(int af, int type, int protocol, SOCKET *sv)
{ {
const char *localhost = NULL;
SOCKET svr = INVALID_SOCKET, r = INVALID_SOCKET, w = INVALID_SOCKET; SOCKET svr = INVALID_SOCKET, r = INVALID_SOCKET, w = INVALID_SOCKET;
struct sockaddr_in sock_in4; struct sockaddr_in sock_in4;
#ifdef INET6 #ifdef INET6
@ -3761,7 +3746,7 @@ rb_w32_asynchronize(asynchronous_func_t func, uintptr_t self,
}); });
if (!thr) { if (!thr) {
rb_fatal("failed to launch waiter thread:%d", GetLastError()); rb_fatal("failed to launch waiter thread:%ld", GetLastError());
} }
return val; return val;
@ -3790,7 +3775,6 @@ rb_w32_get_environ(void)
myenvtop = (char **)malloc(sizeof(char *) * (num + 1)); myenvtop = (char **)malloc(sizeof(char *) * (num + 1));
for (env = envtop, myenv = myenvtop; *env; env += strlen(env) + 1) { for (env = envtop, myenv = myenvtop; *env; env += strlen(env) + 1) {
if (*env != '=') { if (*env != '=') {
int len = strlen(env) + 1;
if (!(*myenv = strdup(env))) { if (!(*myenv = strdup(env))) {
break; break;
} }
@ -3919,9 +3903,7 @@ int
rb_w32_utime(const char *path, const struct utimbuf *times) rb_w32_utime(const char *path, const struct utimbuf *times)
{ {
HANDLE hFile; HANDLE hFile;
SYSTEMTIME st;
FILETIME atime, mtime; FILETIME atime, mtime;
struct tm *tm;
struct stati64 stat; struct stati64 stat;
int ret = 0; int ret = 0;