Project

General

Profile

ActionsLike0

Bug #5833

closed

[mingw] trivial patch for thread.c build warning

Added by jonforums (Jon Forums) about 13 years ago. Updated about 13 years ago.

Status:
Closed
Target version:
ruby -v:
-
Backport:
[ruby-core:41870]

Description

When building with MinGW (not Windows SDK) on Win7 I get the following:

compiling ../../../../Users/Jon/Documents/RubyDev/ruby-git/thread.c
../../../../Users/Jon/Documents/RubyDev/ruby-git/thread.c: In function 'rb_fd_rcopy':
../../../../Users/Jon/Documents/RubyDev/ruby-git/thread.c:2471:33: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]

Below is a trivial patch that fixes the warning on MinGW. The patch successfully builds and tests with MinGW and Windows SDK on Win7 32bit. When building on Arch Linux, the patched build gives the same make test && make test-all results (6 errors, 45 skips) as an unpatched build. In all other uses in thread.c (except for rb_fd_rcopy) the rb_fd_max macro generates a size_t object. From what I can tell, use cases are all unsigned int's.

diff --git a/thread.c b/thread.c
index d9fe5506..0b48061 100644
--- a/thread.c
+++ b/thread.c
@@ -2463,7 +2463,7 @@ rb_fd_init_copy(rb_fdset_t *dst, rb_fdset_t *src)
static void
rb_fd_rcopy(fd_set *dst, rb_fdset_t *src)
{

  • int max = rb_fd_max(src);
  • size_t max = rb_fd_max(src);

    /* we assume src is the result of select() with dst, so dst should be

    • larger or equal than src. */

Updated by kosaki (Motohiro KOSAKI) about 13 years ago

  • ruby -v changed from ruby 2.0.0dev (2011-12-31 trunk 34165) [i386-mingw32] to -
#3

Updated by ko1 (Koichi Sasada) about 13 years ago

  • Assignee set to akr (Akira Tanaka)

Updated by nobu (Nobuyoshi Nakada) about 13 years ago

  • Status changed from Open to Closed
ActionsLike0

Also available in: Atom PDF