Fix clang warnings

This commit is contained in:
Howard Hinnant
2014-02-25 15:49:27 -05:00
committed by Vinnie Falco
parent 9bf1a76e91
commit cd30e552a7
28 changed files with 115 additions and 66 deletions

View File

@@ -29,9 +29,8 @@ namespace PeerFinder {
class Counts
{
public:
explicit Counts (clock_type& clock)
: m_clock (clock)
, m_attempts (0)
Counts ()
: m_attempts (0)
, m_active (0)
, m_in_max (0)
, m_in_active (0)
@@ -299,8 +298,6 @@ private:
}
private:
clock_type& m_clock;
/** Outbound connection attempts. */
int m_attempts;

View File

@@ -65,7 +65,7 @@ public:
clock_type& clock,
Journal journal)
: stopping (false)
, counts (clock)
, counts ()
, livecache (clock, Journal (
journal, Reporting::livecache))
, bootcache (*store, clock, Journal (

View File

@@ -201,8 +201,6 @@ public:
{
SharedState::Access state (m_state);
Table::iterator iter (
state->table.find (*prior.key));
std::pair <Table::iterator, bool> result (
state->table.emplace (key, 0));
entry = &result.first->second;

View File

@@ -87,7 +87,7 @@ public:
Consumer c (logic.newInboundEndpoint (addr));
// Create load until we get a warning
for (std::size_t n (maxLoopCount); n>=0; --n)
for (std::size_t n (maxLoopCount); true; --n)
{
if (n == 0)
{
@@ -104,7 +104,7 @@ public:
}
// Create load until we get dropped
for (std::size_t n (maxLoopCount); n>=0; --n)
for (std::size_t n (maxLoopCount); true; --n)
{
if (n == 0)
{
@@ -127,7 +127,7 @@ public:
expect (c.disconnect ());
}
for (std::size_t n (maxLoopCount); n>=0; --n)
for (std::size_t n (maxLoopCount); true; --n)
{
Consumer c (logic.newInboundEndpoint (addr));
if (n == 0)

View File

@@ -296,6 +296,15 @@ Status BlockBasedTableBuilder::status() const {
return rep_->status;
}
//
// Warning: This function is also being used in the file
// block_based_table_reader.cc even though it is declared static, due
// to the source-file-concatenation build scheme. There is an idential
// file-local function in block_based_table_reader.cc too, but it was
// not being used.
// Do not change this function without reviewing its impact on the code
// in block_based_table_reader.cc.
//
static void DeleteCachedBlock(const Slice& key, void* value) {
Block* block = reinterpret_cast<Block*>(value);
delete block;

View File

@@ -166,10 +166,28 @@ void DeleteBlock(void* arg, void* ignored) {
delete reinterpret_cast<Block*>(arg);
}
void DeleteCachedBlock(const Slice& key, void* value) {
Block* block = reinterpret_cast<Block*>(value);
delete block;
}
//
// Commented out DeleteCachedBlock to silence the following warning:
//
// warning: unused function 'DeleteCachedBlock'
//
// Although it looks like this function is being used later in this file,
// it is not. Instead a file-static function of the same name is being
// used from block_based_table_builder.cc. That function is being found
// because this file and block_based_table_builder.cc are being
// concatenated in ripple_rocksdb.cpp. Fortunately the version of
// DeleteCachedBlock in block_based_table_builder.cc is identical to this
// one. So everything is working.
//
// This function has not been removed because it will need to be
// uncommented in the event we abandon the source file concatenation build
// model. In that event, failure to uncomment this function will lead to a
// compile-time error, not a run-time error (so this is safe).
//
// void DeleteCachedBlock(const Slice& key, void* value) {
// Block* block = reinterpret_cast<Block*>(value);
// delete block;
// }
void DeleteCachedFilter(const Slice& key, void* value) {
auto filter = reinterpret_cast<FilterBlockReader*>(value);