Skip to content

Conversation

@mcelrath
Copy link

Clean up some warnings (and one error) when compiling in C++11 mode with g++ and clang. Details:

  • -Wno-self-assign is no longer a valid warning to disable
  • All the stuff in leveldb is cases of comparison between signed and unsigned
  • The change in rpcserver.cpp is an error with gcc 5.2, apparently older versions can do an automatic conversion here but in C++11 mode it needs an explicit conversion to shared_ptr.

There are other warnings due to a few uses of std::auto_ptr which is deprecated. When we switch to compiling in C++11 mode by default, we'll have to convert these to std::unique_ptr, but this is a non-backwards compatible change so can't be done now.

@dcousens
Copy link
Contributor

utACK

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heh, on its own, this just looks like const = 0.

@gmaxwell
Copy link
Contributor

I really do not want to carry around and maintain a patch for leveldb for superfluous warnings.

@jgarzik
Copy link
Contributor

jgarzik commented Oct 29, 2015

Agree w/ @gmaxwell - we want to avoid patching leveldb

@dcousens
Copy link
Contributor

@mcelrath, given the above, maybe just the rpcserver change?

@mcelrath
Copy link
Author

Dunno, I wouldn't want leveldb in the core in the first place...

I haven't analyzed these sign comparisons to see if they could overflow, but I find the idea pretty scary. But I don't think this is an argument worth having. Will backout everything except the rpcserver change. We can remove the -Wno-self-assign when we actually switch to C++11.

@mcelrath mcelrath changed the title Warnings clean with C++11 Add explicit shared_ptr constructor due to C++11 error Oct 29, 2015
@laanwj
Copy link
Member

laanwj commented Oct 29, 2015

yes, definitely just fix the error. If the warnings point at critical problems, then hiding the warnings by fuzzing the types a bit is a disservice.

utACK

@dcousens
Copy link
Contributor

reACK

@laanwj laanwj merged commit a83f3c2 into bitcoin:master Oct 29, 2015
laanwj added a commit that referenced this pull request Oct 29, 2015
a83f3c2 Add explicit shared_ptr constructor due to C++11 error (Bob McElrath)
@mcelrath
Copy link
Author

FWIW, the unsigned change was all to do with the "n" parameter of a Bloom filter, which is its number of bits, and is nonsensical for it to be negative. I'm sure these warnings have nothing to do with C++11 mode...

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants