[前][次][番号順一覧][スレッド一覧]

ruby-changes:45545

From: nobu <ko1@a...>
Date: Mon, 13 Feb 2017 14:44:22 +0900 (JST)
Subject: [ruby-changes:45545] nobu:r57618 (trunk): suppress warnings

nobu	2017-02-13 14:44:15 +0900 (Mon, 13 Feb 2017)

  New Revision: 57618

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=57618

  Log:
    suppress warnings
    
    * string.c (rb_str_enumerate_lines): hint to suppress a
      maybe-uninitialized warning by gcc.
    
    * thread.c (rb_fd_no_init): ditto.

  Modified files:
    trunk/string.c
    trunk/thread.c
Index: string.c
===================================================================
--- string.c	(revision 57617)
+++ string.c	(revision 57618)
@@ -7517,6 +7517,9 @@ rb_str_enumerate_lines(int argc, VALUE * https://github.com/ruby/ruby/blob/trunk/string.c#L7517
 	    wantarray = 0;
 #endif
 	}
+#if defined __GNUC__ && !defined __clang__
+	ASSUME(wantarray || !ary); /* if wantarray, ary does not matter */
+#endif
     }
     else {
 	if (wantarray)
Index: thread.c
===================================================================
--- thread.c	(revision 57617)
+++ thread.c	(revision 57618)
@@ -3573,8 +3573,8 @@ rb_fd_select(int n, rb_fdset_t *readfds, https://github.com/ruby/ruby/blob/trunk/thread.c#L3573
     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) https://github.com/ruby/ruby/blob/trunk/thread.c#L3640
 #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, https://github.com/ruby/ruby/blob/trunk/thread.c#L3677
 }
 
 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;

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]