-
Notifications
You must be signed in to change notification settings - Fork 38.7k
Clang cleanup #2123
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
Clang cleanup #2123
Conversation
|
Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/75fafc30d24648588801baa50242c6d05cd5d75b for binaries and test log. |
src/serialize.h
Outdated
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.
This needs 4 spaced as indention :).
|
Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/3d12bdaa7ce61bc6dbe395a7f083325f041b4a00 for binaries and test log. |
|
I'm interested in how that analyzer outputs found stuff, can you perhaps post that? As I'm on Windows it's not that easy to get such stuff working over here ;). |
|
On Linux, you can get the analyzer to run by adding CXX=clang++ --analyze right above the "LINK=$(CXX)" line in makefile.unix, then do a full build. It will output its warnings as though it were a compiler (though it won't actually compile anything). I'm not familiar with the Windows build process, sorry. |
|
I've also seen these warnings by the analyzer, but I'm not so sure about removing the code. It's there to make maintenance easier (ie, will make it somewhat more robust when adding code by making sure hSOCKET will never have an invalid value, and nSize will always be up to date). Compilers are generally smart enough to remove dead code like this in the binary. |
|
agree with @laanwj Being able to get useful information through a static analyzer is nice, though. |
|
It would be indeed better to keep these 2 and so I'm fine with just closing this. |
|
Closing this, I like the belt-and-suspenders easier-to-maintain code. |
Yesterday LLVM 3.2 was released, as well as a corresponding version of the clang compiler and static analyzer.
I ran the static analyzer over the bitcoin code and picked up a couple of assignments to variables that are never read. These two patches remove those assigments.