Skip to content

cext will only compile if warnings are lenient.#121

Closed
dekellum wants to merge 1 commit intojruby:jruby-1_6from
dekellum:cext-compile-with-warnings
Closed

cext will only compile if warnings are lenient.#121
dekellum wants to merge 1 commit intojruby:jruby-1_6from
dekellum:cext-compile-with-warnings

Conversation

@dekellum
Copy link
Contributor

@dekellum dekellum commented Feb 4, 2012

I don't understand the cext code itself well enough to fix this warning directly, but compiling without -Werror allows the build to succeed and everything appears to work correctly.

Otherwise:

     [exec] /home/david/src/jruby/cext/src/thread.cpp: In function ‘int rb_thread_select(int, fd_set*, fd_set*, fd_set*, timeval*)’:
     [exec] /home/david/src/jruby/cext/src/thread.cpp:92:26: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
     [exec] cc1plus: all warnings being treated as errors
     [exec]
     [exec] make[1]: *** [/home/david/src/jruby/cext/src/../..//build/thread.o] Error 1
     [exec] make[1]: Leaving directory `/home/david/src/jruby/cext/src'
     [exec] make: *** [all] Error 2

On:

Fedora 16 (x64)
gcc (GCC) 4.6.2 20111027 (Red Hat 4.6.2-1)

Otherwise:

     [exec] /home/david/src/jruby/cext/src/thread.cpp: In function ‘int rb_thread_select(int, fd_set*, fd_set*, fd_set*, timeval*)’:
     [exec] /home/david/src/jruby/cext/src/thread.cpp:92:26: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
     [exec] cc1plus: all warnings being treated as errors
     [exec]
     [exec] make[1]: *** [/home/david/src/jruby/cext/src/../..//build/thread.o] Error 1
     [exec] make[1]: Leaving directory `/home/david/src/jruby/cext/src'
     [exec] make: *** [all] Error 2

On:

Fedora 16 (x64)
gcc (GCC) 4.6.2 20111027 (Red Hat 4.6.2-1)
@timfel
Copy link
Member

timfel commented Feb 6, 2012

I will look into it sometime this week. I am reluctant to disable -Werror because it helps catch quite a few sources of possible SEGV and I don't want to risk us shipping C ext libs in a release that have these problems.

@tychobrailleur
Copy link
Contributor

I had submitted a patch for this in Jira (http://jira.codehaus.org/browse/JRUBY-6378?focusedCommentId=290224&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-290224), but it'd be good if someone with more C++ than me could review the patch.

@timfel
Copy link
Member

timfel commented Feb 6, 2012

Okay @tychobrailleur, you have a commit in JRuby master now :) @dekellum, can you please confirm that it now works for you?

@tychobrailleur
Copy link
Contributor

Thanks @timfel. I take it reinterpret_cast in that instance is ok, then?

@timfel
Copy link
Member

timfel commented Feb 6, 2012

Well, it works, and I'm pretty sure 32-bit ints will always fit into whatever any JRuby supported system's ptr size is, so yeah, let's consider ourselves smarter than our compiler and just go with it ;)

@timfel timfel closed this Feb 6, 2012
@dekellum
Copy link
Contributor Author

dekellum commented Feb 7, 2012

And @tychobrailleur's C++ patch does, now that I've had a chance to look, work for me as well. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants