Fix some warnings in clang 3.7.1#253
Conversation
|
Some of these changes don't make sense to me. Please verify what compiler flags you have enabled so I can test it for myself. |
|
-Wall -Wextra -Werror -Wshadow -Wconversion -Wno-long-long -pedantic -Wno-unused-parameter These are my warnings. Clang 3.7.1 |
|
I might as well add that when I also included the standard lib, I got these warnings in there as well which my pull request doesn't address: http://hastebin.com/poqexoliba.vhdl |
|
Ok, thanks for the heads up. I'm going to take a VERY close look at these changes, as I've just noticed a potential bug that is found with implicit sign conversion warnings that your fix propagates, instead of addressing. I'll get it patched in the next day or so. I try to avoid casts whenever possible. I'm going to add a line note to the part I just noticed. |
| // Let's see if this is a link that we should expand | ||
| std::vector<char> buf(2048); | ||
| const size_t pathlen = readlink(dllpath.c_str(), &buf.front(), buf.size()); | ||
| const size_t pathlen = static_cast<size_t>(readlink(dllpath.c_str(), &buf.front(), buf.size())); |
There was a problem hiding this comment.
Note that just static_cast<size_t> here fails to address the problem that readlink can actually return a negative value, which I look for on the very next line. So there's been a lingering bug here for quite some time.
There was a problem hiding this comment.
Thanks for pointing out these issues.
|
Yep, fair enough! No worries, and thanks for jumping onto the issue quickly! |
|
Fixed now on develop. I used slightly different techniques. See: 645377e...d4f02b5 |
The library was unusable for me since I have -Werror on. This pull request solves it for me.