From 957e6e4b14db5954c416c958aa54a5ecc0d16410 Mon Sep 17 00:00:00 2001 From: nobu Date: Tue, 14 Feb 2017 07:52:30 +0000 Subject: [PATCH] initialize variables * string.c (rb_str_enumerate_lines): initialize conditionally used variable. * thread.c (rb_fd_no_init): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57625 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- string.c | 6 +----- thread.c | 8 ++------ 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/string.c b/string.c index b9bd9098da..7045d16f4f 100644 --- a/string.c +++ b/string.c @@ -7493,8 +7493,7 @@ rb_str_enumerate_lines(int argc, VALUE *argv, VALUE str, int wantarray) const char *ptr, *pend, *subptr, *subend, *rsptr, *hit, *adjusted; long pos, len, rslen; int rsnewline = 0; - - VALUE MAYBE_UNUSED(ary); + VALUE ary = 0; if (rb_scan_args(argc, argv, "01:", &rs, &opts) == 0) rs = rb_rs; @@ -7517,9 +7516,6 @@ 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 e1968c44d2..39fdf9d23d 100644 --- a/thread.c +++ b/thread.c @@ -3573,9 +3573,7 @@ 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__ >= 5 -# define rb_fd_no_init(fds) ASSUME(!(fds)->fdset && !(fds)->maxfd) -#endif +#define rb_fd_no_init(fds) (((fds)->fdset = 0), ((fds)->maxfd = 0)) #undef FD_ZERO #undef FD_SET @@ -3640,9 +3638,7 @@ 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__ >= 5 -# define rb_fd_no_init(fds) ASSUME(!(fds)->fdset) -#endif +#define rb_fd_no_init(fds) ((fds)->fdset = 0) #endif