From 87e4ad0a236217fb27c3a0a22a1c3b4937f29771 Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 26 Apr 2008 09:36:35 +0000 Subject: [PATCH] * io.c, signal.c, thread.c, thread_win32.c, include/ruby/intern.h: suppress warnings. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16204 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ include/ruby/intern.h | 2 +- io.c | 3 +++ signal.c | 5 ++++- thread.c | 14 ++++++++------ thread_win32.c | 10 +++++----- 6 files changed, 26 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5f5d467d87..d081251f5c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Sat Apr 26 18:36:31 2008 Nobuyoshi Nakada + + * io.c, signal.c, thread.c, thread_win32.c, include/ruby/intern.h: + suppress warnings. + Sat Apr 26 17:42:30 2008 Nobuyoshi Nakada * error.c (builtin_types), gc.c (count_objects): added Complex and diff --git a/include/ruby/intern.h b/include/ruby/intern.h index 71538e6afb..5272079df7 100644 --- a/include/ruby/intern.h +++ b/include/ruby/intern.h @@ -226,7 +226,7 @@ typedef fd_set rb_fdset_t; #define rb_fd_copy(d, s, n) (*(d) = *(s)) #define rb_fd_ptr(f) (f) #define rb_fd_init(f) FD_ZERO(f) -#define rb_fd_term(f) (f) +#define rb_fd_term(f) (void)(f) #define rb_fd_max(f) FD_SETSIZE #define rb_fd_select(n, rfds, wfds, efds, timeout) select(n, rfds, wfds, efds, timeout) diff --git a/io.c b/io.c index a4382445a0..f84161fb3d 100644 --- a/io.c +++ b/io.c @@ -488,7 +488,10 @@ io_alloc(VALUE klass) static int wsplit_p(rb_io_t *fptr) { +#if defined(HAVE_FCNTL) && defined(F_GETFL) && defined(O_NONBLOCK) int r; +#endif + if (!(fptr->mode & FMODE_WSPLIT_INITIALIZED)) { struct stat buf; if (fstat(fptr->fd, &buf) == 0 && diff --git a/signal.c b/signal.c index 8afc4e187a..3c341358b0 100644 --- a/signal.c +++ b/signal.c @@ -473,12 +473,13 @@ sighandler(int sig) #endif } +#if USE_TRAP_MASK # ifdef HAVE_SIGPROCMASK static sigset_t trap_last_mask; # else static int trap_last_mask; # endif - +#endif #if HAVE_PTHREAD_H #include @@ -961,6 +962,7 @@ install_sighandler(int signum, sighandler_t handler) } } +#if defined(SIGCLD) || defined(SIGCHLD) static void init_sigchld(int sig) { @@ -1001,6 +1003,7 @@ init_sigchld(int sig) trap_last_mask = mask; #endif } +#endif void ruby_sig_finalize() diff --git a/thread.c b/thread.c index 2f1ff92e8f..f0f2dce870 100644 --- a/thread.c +++ b/thread.c @@ -1811,7 +1811,7 @@ do_select(int n, fd_set *read, fd_set *write, fd_set *except, fd_set orig_read, orig_write, orig_except; #ifndef linux - double limit; + double limit = 0; struct timeval wait_rest; if (timeout) { @@ -1862,11 +1862,11 @@ do_select(int n, fd_set *read, fd_set *write, fd_set *except, errno = lerrno; if (result < 0) { - if (errno == EINTR + switch (errno) { + case EINTR: #ifdef ERESTART - || errno == ERESTART + case ERESTART: #endif - ) { if (read) *read = orig_read; if (write) *write = orig_write; if (except) *except = orig_except; @@ -1881,6 +1881,8 @@ do_select(int n, fd_set *read, fd_set *write, fd_set *except, } #endif goto retry; + default: + break; } } return result; @@ -1985,8 +1987,8 @@ timer_thread_function(void) /* check signal */ if (vm->buffered_signal_size && vm->main_thread->exec_signal == 0) { vm->main_thread->exec_signal = rb_get_next_signal(vm); - thread_debug("buffered_signal_size: %d, sig: %d\n", - vm->buffered_signal_size, vm->main_thread->exec_signal); + thread_debug("buffered_signal_size: %ld, sig: %d\n", + (long)vm->buffered_signal_size, vm->main_thread->exec_signal); rb_thread_interrupt(vm->main_thread); } diff --git a/thread_win32.c b/thread_win32.c index ba40d7fe75..a83ede0b94 100644 --- a/thread_win32.c +++ b/thread_win32.c @@ -73,7 +73,7 @@ w32_error(void) GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) & lpMsgBuf, 0, NULL); - rb_bug("%s", lpMsgBuf); + rb_bug("%s", (char*)lpMsgBuf); } static void @@ -116,7 +116,7 @@ w32_wait_events(HANDLE *events, int count, DWORD timeout, rb_thread_t *th) thread_debug(" WaitForMultipleObjects start (count: %d)\n", count); ret = WaitForMultipleObjects(count, targets, FALSE, timeout); - thread_debug(" WaitForMultipleObjects end (ret: %d)\n", ret); + thread_debug(" WaitForMultipleObjects end (ret: %lu)\n", ret); if (ret == WAIT_OBJECT_0 + count - 1 && th) { errno = EINTR; @@ -227,9 +227,9 @@ native_sleep(rb_thread_t *th, struct timeval *tv) /* interrupted. return immediate */ } else { - thread_debug("native_sleep start (%d)\n", (int)msec); + thread_debug("native_sleep start (%lu)\n", msec); ret = w32_wait_events(0, 0, msec, th); - thread_debug("native_sleep done (%d)\n", ret); + thread_debug("native_sleep done (%lu)\n", ret); } th->unblock_function = 0; @@ -393,7 +393,7 @@ native_cond_wait(rb_thread_cond_t *cond, rb_thread_lock_t *mutex) { r = WaitForSingleObject(entry.event, INFINITE); if (r != WAIT_OBJECT_0) { - rb_bug("native_cond_wait: WaitForSingleObject returns %d", r); + rb_bug("native_cond_wait: WaitForSingleObject returns %lu", r); } } native_mutex_lock(mutex);