Turn on -Wmissing-prototypes

Summary: Compiling for iOS has by default turned on -Wmissing-prototypes, which causes rocksdb to fail compiling. This diff turns on -Wmissing-prototypes in our compile options and cleans up all functions with missing prototypes.

Test Plan: compiles

Reviewers: dhruba, haobo, ljin, sdong

Reviewed By: ljin

CC: leveldb

Differential Revision: https://reviews.facebook.net/D17649
This commit is contained in:
Igor Canadi
2014-04-09 21:17:14 -07:00
parent df2a8b6a1a
commit 4daea66343
28 changed files with 157 additions and 114 deletions

View File

@@ -1,3 +1,8 @@
// Copyright (c) 2013, Facebook, Inc. All rights reserved.
// This source code is licensed under the BSD-style license found in the
// LICENSE file in the root directory of this source tree. An additional grant
// of patent rights can be found in the PATENTS file in the same directory.
#include <cstdio>
#include <vector>
#include <atomic>
@@ -23,11 +28,13 @@ uint64_t timeout_sec;
Env *env;
BlobStore* bs;
static std::string RandomString(Random* rnd, uint64_t len) {
namespace {
std::string RandomString(Random* rnd, uint64_t len) {
std::string r;
test::RandomString(rnd, len, &r);
return r;
}
} // namespace
struct Result {
uint32_t writes;
@@ -59,11 +66,13 @@ struct Result {
};
namespace {
Result operator + (const Result &a, const Result &b) {
return Result(a.writes + b.writes, a.reads + b.reads,
a.deletes + b.deletes, a.data_written + b.data_written,
a.data_read + b.data_read);
}
} // namespace
struct WorkerThread {
uint64_t data_size_from, data_size_to;
@@ -131,6 +140,7 @@ static void WorkerThreadBody(void* arg) {
t->stopped.store(true);
}
namespace {
Result StartBenchmark(vector<WorkerThread*>& config) {
for (auto w : config) {
env->StartThread(WorkerThreadBody, w);
@@ -241,6 +251,7 @@ vector<WorkerThread*> SetupBenchmarkReadHeavy() {
return config;
}
} // namespace
int main(int argc, const char** argv) {
srand(33);

View File

@@ -145,6 +145,7 @@ class SanityTestPlainTableFactory : public SanityTest {
Options options_;
};
namespace {
bool RunSanityTests(const std::string& command, const std::string& path) {
std::vector<SanityTest*> sanity_tests = {
new SanityTestBasic(path),
@@ -176,6 +177,7 @@ bool RunSanityTests(const std::string& command, const std::string& path) {
}
return true;
}
} // namespace
} // namespace rocksdb

View File

@@ -271,6 +271,7 @@ static const bool FLAGS_num_iterations_dummy __attribute__((unused)) =
DEFINE_bool(disable_seek_compaction, false,
"Option to disable compation triggered by read.");
namespace {
enum rocksdb::CompressionType StringToCompressionType(const char* ctype) {
assert(ctype);
@@ -290,6 +291,8 @@ enum rocksdb::CompressionType StringToCompressionType(const char* ctype) {
fprintf(stdout, "Cannot parse compression type '%s'\n", ctype);
return rocksdb::kSnappyCompression; //default value
}
} // namespace
DEFINE_string(compression_type, "snappy",
"Algorithm to use to compress the database");
static enum rocksdb::CompressionType FLAGS_compression_type_e =
@@ -323,6 +326,8 @@ enum RepFactory {
kHashSkipList,
kVectorRep
};
namespace {
enum RepFactory StringToRepFactory(const char* ctype) {
assert(ctype);
@@ -336,6 +341,8 @@ enum RepFactory StringToRepFactory(const char* ctype) {
fprintf(stdout, "Cannot parse memreptable %s\n", ctype);
return kSkipList;
}
} // namespace
static enum RepFactory FLAGS_rep_factory;
DEFINE_string(memtablerep, "prefix_hash", "");

View File

@@ -220,6 +220,7 @@ static void print_help() {
" [--show_properties]\n");
}
namespace {
string HexToString(const string& str) {
string parsed;
if (str[0] != '0' || str[1] != 'x') {
@@ -236,6 +237,7 @@ string HexToString(const string& str) {
}
return parsed;
}
} // namespace
int main(int argc, char** argv) {
const char* dir_or_file = nullptr;