thread.c: suppress warnings
* thread.c (do_select): suppress maybe-uninitialized warnings on maxfd. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51774 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
649016bdb1
commit
f476726323
29
thread.c
29
thread.c
@ -3392,6 +3392,8 @@ rb_fd_select(int n, rb_fdset_t *readfds, rb_fdset_t *writefds, rb_fdset_t *excep
|
|||||||
return select(n, r, w, e, timeout);
|
return select(n, r, w, e, timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define rb_fd_no_init(fds) ASSUME(!(fds)->maxfd)
|
||||||
|
|
||||||
#undef FD_ZERO
|
#undef FD_ZERO
|
||||||
#undef FD_SET
|
#undef FD_SET
|
||||||
#undef FD_CLR
|
#undef FD_CLR
|
||||||
@ -3457,6 +3459,10 @@ rb_fd_set(int fd, rb_fdset_t *set)
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef rb_fd_no_init
|
||||||
|
#define rb_fd_no_init(fds) (void)(fds)
|
||||||
|
#endif
|
||||||
|
|
||||||
static inline int
|
static inline int
|
||||||
retryable(int e)
|
retryable(int e)
|
||||||
{
|
{
|
||||||
@ -3510,12 +3516,12 @@ do_select(int n, rb_fdset_t *readfds, rb_fdset_t *writefds,
|
|||||||
timeout = &wait_rest;
|
timeout = &wait_rest;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (readfds)
|
#define fd_init_copy(f) \
|
||||||
rb_fd_init_copy(&orig_read, readfds);
|
(f##fds) ? rb_fd_init_copy(&orig_##f, f##fds) : rb_fd_no_init(&orig_##f)
|
||||||
if (writefds)
|
fd_init_copy(read);
|
||||||
rb_fd_init_copy(&orig_write, writefds);
|
fd_init_copy(write);
|
||||||
if (exceptfds)
|
fd_init_copy(except);
|
||||||
rb_fd_init_copy(&orig_except, exceptfds);
|
#undef fd_init_copy
|
||||||
|
|
||||||
do {
|
do {
|
||||||
lerrno = 0;
|
lerrno = 0;
|
||||||
@ -3529,12 +3535,11 @@ do_select(int n, rb_fdset_t *readfds, rb_fdset_t *writefds,
|
|||||||
RUBY_VM_CHECK_INTS_BLOCKING(th);
|
RUBY_VM_CHECK_INTS_BLOCKING(th);
|
||||||
} while (result < 0 && retryable(errno = lerrno) && do_select_update());
|
} while (result < 0 && retryable(errno = lerrno) && do_select_update());
|
||||||
|
|
||||||
if (readfds)
|
#define fd_term(f) if (f##fds) rb_fd_term(&orig_##f)
|
||||||
rb_fd_term(&orig_read);
|
fd_term(read);
|
||||||
if (writefds)
|
fd_term(write);
|
||||||
rb_fd_term(&orig_write);
|
fd_term(except);
|
||||||
if (exceptfds)
|
#undef fd_term
|
||||||
rb_fd_term(&orig_except);
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user