From a37129002dedf33e1238abb7bea7ba0c977c04cb Mon Sep 17 00:00:00 2001 From: nobu Date: Mon, 13 Feb 2017 05:44:15 +0000 Subject: suppress warnings * string.c (rb_str_enumerate_lines): hint to suppress a maybe-uninitialized warning by gcc. * thread.c (rb_fd_no_init): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57618 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- string.c | 3 +++ thread.c | 12 ++++++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/string.c b/string.c index d894b24daf..b9bd9098da 100644 --- a/string.c +++ b/string.c @@ -7517,6 +7517,9 @@ rb_str_enumerate_lines(int argc, VALUE *argv, VALUE str, int wantarray) wantarray = 0; #endif } +#if defined __GNUC__ && !defined __clang__ + ASSUME(wantarray || !ary); /* if wantarray, ary does not matter */ +#endif } else { if (wantarray) diff --git a/thread.c b/thread.c index 82369cb9d4..6fcb4e4b9b 100644 --- a/thread.c +++ b/thread.c @@ -3573,8 +3573,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); } -#if defined __GNUC__ && __GNUC__ >= 6 -#define rb_fd_no_init(fds) ASSUME(!(fds)->maxfd) +#if defined __GNUC__ && __GNUC__ >= 4 +# define rb_fd_no_init(fds) ASSUME(!(fds)->fdset && !(fds)->maxfd) #endif #undef FD_ZERO @@ -3640,6 +3640,10 @@ rb_fd_set(int fd, rb_fdset_t *set) #define FD_CLR(i, f) rb_fd_clr((i), (f)) #define FD_ISSET(i, f) rb_fd_isset((i), (f)) +#if defined __GNUC__ && __GNUC__ >= 4 +# define rb_fd_no_init(fds) ASSUME(!(fds)->fdset) +#endif + #endif #ifndef rb_fd_no_init @@ -3673,8 +3677,8 @@ update_timeval(struct timeval *timeout, double limit) } static int -do_select(int n, rb_fdset_t *readfds, rb_fdset_t *writefds, - rb_fdset_t *exceptfds, struct timeval *timeout) +do_select(int n, rb_fdset_t *const readfds, rb_fdset_t *const writefds, + rb_fdset_t *const exceptfds, struct timeval *timeout) { int MAYBE_UNUSED(result); int lerrno; -- cgit v1.2.3