Fix clang build

Summary: Fix clang

Test Plan:
USE_CLANG=1 make all -j64

Reviewers: sdong, yhchiang, anthony, rven

Reviewed By: rven

Subscribers: dhruba

Differential Revision: https://reviews.facebook.net/D50793
This commit is contained in:
Islam AbdelRahman 2015-11-16 14:14:39 -08:00
parent 4175472ad6
commit ca5566d209

View File

@ -35,8 +35,8 @@ int main() {
const int MAX_SHARDS = 100000; const int MAX_SHARDS = 100000;
DEFINE_int64(writers, 8, ""); DEFINE_int32(writers, 8, "");
DEFINE_int64(readers, 8, ""); DEFINE_int32(readers, 8, "");
DEFINE_int64(rate, 100000, ""); DEFINE_int64(rate, 100000, "");
DEFINE_int64(value_size, 300, ""); DEFINE_int64(value_size, 300, "");
DEFINE_int64(shards, 1000, ""); DEFINE_int64(shards, 1000, "");
@ -48,12 +48,12 @@ DEFINE_bool(cache_only_first, true, "");
DEFINE_bool(iterate_upper_bound, true, ""); DEFINE_bool(iterate_upper_bound, true, "");
struct Stats { struct Stats {
char pad1[128]; char pad1[128] __attribute__((__unused__));
std::atomic<uint64_t> written{0}; std::atomic<uint64_t> written{0};
char pad2[128]; char pad2[128] __attribute__((__unused__));
std::atomic<uint64_t> read{0}; std::atomic<uint64_t> read{0};
std::atomic<uint64_t> cache_misses{0}; std::atomic<uint64_t> cache_misses{0};
char pad3[128]; char pad3[128] __attribute__((__unused__));
} stats; } stats;
struct Key { struct Key {
@ -73,17 +73,17 @@ struct Reader;
struct Writer; struct Writer;
struct ShardState { struct ShardState {
char pad1[128]; char pad1[128] __attribute__((__unused__));
std::atomic<uint64_t> last_written{0}; std::atomic<uint64_t> last_written{0};
Writer* writer; Writer* writer;
Reader* reader; Reader* reader;
char pad2[128]; char pad2[128] __attribute__((__unused__));
std::atomic<uint64_t> last_read{0}; std::atomic<uint64_t> last_read{0};
std::unique_ptr<rocksdb::Iterator> it; std::unique_ptr<rocksdb::Iterator> it;
std::unique_ptr<rocksdb::Iterator> it_cacheonly; std::unique_ptr<rocksdb::Iterator> it_cacheonly;
Key upper_bound; Key upper_bound;
rocksdb::Slice upper_bound_slice; rocksdb::Slice upper_bound_slice;
char pad3[128]; char pad3[128] __attribute__((__unused__));
}; };
struct Reader { struct Reader {
@ -187,7 +187,7 @@ struct Reader {
} }
private: private:
char pad1[128]; char pad1[128] __attribute__((__unused__));
std::vector<ShardState>* shard_states_; std::vector<ShardState>* shard_states_;
rocksdb::DB* db_; rocksdb::DB* db_;
std::thread thread_; std::thread thread_;
@ -196,7 +196,7 @@ struct Reader {
std::bitset<MAX_SHARDS + 1> shards_pending_set_; std::bitset<MAX_SHARDS + 1> shards_pending_set_;
std::queue<uint64_t> shards_pending_queue_; std::queue<uint64_t> shards_pending_queue_;
std::atomic<bool> done_{false}; std::atomic<bool> done_{false};
char pad2[128]; char pad2[128] __attribute__((__unused__));
}; };
struct Writer { struct Writer {
@ -218,7 +218,8 @@ struct Writer {
} }
std::mt19937 rng{std::random_device()()}; std::mt19937 rng{std::random_device()()};
std::uniform_int_distribution<int> shard_dist(0, my_shards.size() - 1); std::uniform_int_distribution<int> shard_dist(
0, static_cast<int>(my_shards.size()) - 1);
std::string value(FLAGS_value_size, '*'); std::string value(FLAGS_value_size, '*');
while (1) { while (1) {
@ -256,11 +257,11 @@ struct Writer {
~Writer() { thread_.join(); } ~Writer() { thread_.join(); }
private: private:
char pad1[128]; char pad1[128] __attribute__((__unused__));
std::vector<ShardState>* shard_states_; std::vector<ShardState>* shard_states_;
rocksdb::DB* db_; rocksdb::DB* db_;
std::thread thread_; std::thread thread_;
char pad2[128]; char pad2[128] __attribute__((__unused__));
}; };
struct StatsThread { struct StatsThread {