From ca5566d2094d13c48862931a52607b05eedd8540 Mon Sep 17 00:00:00 2001 From: Islam AbdelRahman Date: Mon, 16 Nov 2015 14:14:39 -0800 Subject: [PATCH] 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 --- db/forward_iterator_bench.cc | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/db/forward_iterator_bench.cc b/db/forward_iterator_bench.cc index 6dcb74409..c0ac3b1b0 100644 --- a/db/forward_iterator_bench.cc +++ b/db/forward_iterator_bench.cc @@ -35,8 +35,8 @@ int main() { const int MAX_SHARDS = 100000; -DEFINE_int64(writers, 8, ""); -DEFINE_int64(readers, 8, ""); +DEFINE_int32(writers, 8, ""); +DEFINE_int32(readers, 8, ""); DEFINE_int64(rate, 100000, ""); DEFINE_int64(value_size, 300, ""); DEFINE_int64(shards, 1000, ""); @@ -48,12 +48,12 @@ DEFINE_bool(cache_only_first, true, ""); DEFINE_bool(iterate_upper_bound, true, ""); struct Stats { - char pad1[128]; + char pad1[128] __attribute__((__unused__)); std::atomic written{0}; - char pad2[128]; + char pad2[128] __attribute__((__unused__)); std::atomic read{0}; std::atomic cache_misses{0}; - char pad3[128]; + char pad3[128] __attribute__((__unused__)); } stats; struct Key { @@ -73,17 +73,17 @@ struct Reader; struct Writer; struct ShardState { - char pad1[128]; + char pad1[128] __attribute__((__unused__)); std::atomic last_written{0}; Writer* writer; Reader* reader; - char pad2[128]; + char pad2[128] __attribute__((__unused__)); std::atomic last_read{0}; std::unique_ptr it; std::unique_ptr it_cacheonly; Key upper_bound; rocksdb::Slice upper_bound_slice; - char pad3[128]; + char pad3[128] __attribute__((__unused__)); }; struct Reader { @@ -187,7 +187,7 @@ struct Reader { } private: - char pad1[128]; + char pad1[128] __attribute__((__unused__)); std::vector* shard_states_; rocksdb::DB* db_; std::thread thread_; @@ -196,7 +196,7 @@ struct Reader { std::bitset shards_pending_set_; std::queue shards_pending_queue_; std::atomic done_{false}; - char pad2[128]; + char pad2[128] __attribute__((__unused__)); }; struct Writer { @@ -218,7 +218,8 @@ struct Writer { } std::mt19937 rng{std::random_device()()}; - std::uniform_int_distribution shard_dist(0, my_shards.size() - 1); + std::uniform_int_distribution shard_dist( + 0, static_cast(my_shards.size()) - 1); std::string value(FLAGS_value_size, '*'); while (1) { @@ -256,11 +257,11 @@ struct Writer { ~Writer() { thread_.join(); } private: - char pad1[128]; + char pad1[128] __attribute__((__unused__)); std::vector* shard_states_; rocksdb::DB* db_; std::thread thread_; - char pad2[128]; + char pad2[128] __attribute__((__unused__)); }; struct StatsThread {