New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix compilation warnings #1731
fix compilation warnings #1731
Conversation
remove a few that generate lots of warnings on ruby.h: - -Wcast-qual - -Wconversion add -Wextra back (it was removed in 2008)
to fix compiler warnings. the node->type check is polymorphic, and so a macro makes more sense to me (so we get some compile-time checking) than force-typecasting.
xmlNewCDataBlock() takes ptr and len, so we can use RSTRING_LEN() instead of strlen(). strlen() was introduced in commit c766f6e to fix a segfault, but it's enough to execute StringValuePtr() and RSTRING_LEN() in order to avoid invalid memory access.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Warning in rb_scan_args() is ruby intern, we can't control it in our source code. So removing -Wconversion is OK.
For -Wconst-qual
I opened #1735 as an alternative approach.
IMHO the rest can't be done better than you did. Great job as usual!
…arnings Flavorjones fix compilation warnings
I've merged #1735 in here ... everyone OK to merge this into master? |
Just as reported in #1772, I believe this has broken the build where the following conditions are both met:
My mkmf.log has the following lines:
The combination of |
@knu Can you help me reproduce this? I'm on Linux, and I've tried on Ruby 2.4.1 with and without the pkg-config gem, and cannot reproduce this issue. Can you describe your environment? |
I've also tried to reproduce with Ruby 2.5.1 and I cannot. Here's my mkmf.log snippet:
|
Sure, I've minimized my case as uploaded here: https://gist.github.com/knu/2650e7d924e818ad4441dc06017162d1 Place the three files in the same directory and run |
There must be subtle differences somewhere. On environments where the build fails, it seems the compiler is invoked without warnflags added, which should include |
Testing on Fedora Rawhide:
|
The only difference in the check for "libxml-2.0" is the difference in -Wextra vs -Wconversion flags and the subsequent warnings. |
Broken for me on Ubuntu 16.04 (xenial) and 18.04 (bionic), both long term supported release of Ubuntu.
git bisect found 77be60c to be the culprit. xenial is ruby 2.3 and bionic is ruby 2.5. This Dockerfile reproduces it, just put it in an empty dir and run
|
Please see #1722 for details, but this will be fixed in 1.8.5, due out soon. |
Trying to make compilation produce no meaningful errors. Would love to have a second pair of eyes on this.