Fix compile

Summary: gcc on our dev boxes is not happy about __attribute__((unused))

Test Plan: compiles now

Reviewers: sdong, ljin

Reviewed By: ljin

Subscribers: leveldb

Differential Revision: https://reviews.facebook.net/D22707
This commit is contained in:
Igor Canadi 2014-09-02 11:49:38 -07:00
parent 990df99a61
commit 076bd01a29
6 changed files with 10 additions and 21 deletions

View file

@ -116,7 +116,7 @@ class ShortenedIndexBuilder : public IndexBuilder {
public:
explicit ShortenedIndexBuilder(const Comparator* comparator)
: IndexBuilder(comparator),
index_block_builder_(1 /* block_restart_interval == 1 */, comparator) {}
index_block_builder_(1 /* block_restart_interval == 1 */) {}
virtual void AddIndexEntry(std::string* last_key_in_current_block,
const Slice* first_key_in_next_block,
@ -420,7 +420,7 @@ struct BlockBasedTableBuilder::Rep {
table_options(table_opt),
internal_comparator(icomparator),
file(f),
data_block(table_options.block_restart_interval, &internal_comparator),
data_block(table_options.block_restart_interval),
internal_prefix_transform(options.prefix_extractor.get()),
index_builder(CreateIndexBuilder(
table_options.index_type, &internal_comparator,

View file

@ -41,10 +41,8 @@
namespace rocksdb {
BlockBuilder::BlockBuilder(int block_restart_interval,
const Comparator* comparator)
BlockBuilder::BlockBuilder(int block_restart_interval)
: block_restart_interval_(block_restart_interval),
comparator_(comparator),
restarts_(),
counter_(0),
finished_(false) {
@ -96,8 +94,6 @@ void BlockBuilder::Add(const Slice& key, const Slice& value) {
Slice last_key_piece(last_key_);
assert(!finished_);
assert(counter_ <= block_restart_interval_);
assert(buffer_.empty() // No values yet?
|| comparator_->Compare(key, last_key_piece) > 0);
size_t shared = 0;
if (counter_ < block_restart_interval_) {
// See how much sharing to do with previous string

View file

@ -22,7 +22,7 @@ class BlockBuilder {
BlockBuilder(const BlockBuilder&) = delete;
void operator=(const BlockBuilder&) = delete;
BlockBuilder(int block_restart_interval, const Comparator* comparator);
explicit BlockBuilder(int block_restart_interval);
// Reset the contents as if the BlockBuilder was just constructed.
void Reset();
@ -50,7 +50,6 @@ class BlockBuilder {
private:
const int block_restart_interval_;
const Comparator* comparator_ __attribute__((unused)); // only used in assert
std::string buffer_; // Destination buffer
std::vector<uint32_t> restarts_; // Restart points

View file

@ -76,7 +76,7 @@ TEST(BlockTest, SimpleTest) {
std::vector<std::string> keys;
std::vector<std::string> values;
BlockBuilder builder(16, ic.get());
BlockBuilder builder(16);
int num_records = 100000;
GenerateRandomKVs(&keys, &values, 0, num_records);
@ -132,8 +132,7 @@ BlockContents GetBlockContents(std::unique_ptr<BlockBuilder> *builder,
const std::vector<std::string> &keys,
const std::vector<std::string> &values,
const int prefix_group_size = 1) {
builder->reset(
new BlockBuilder(1 /* restart interval */, BytewiseComparator()));
builder->reset(new BlockBuilder(1 /* restart interval */));
// Add only half of the keys
for (size_t i = 0; i < keys.size(); ++i) {

View file

@ -16,9 +16,7 @@
namespace rocksdb {
MetaIndexBuilder::MetaIndexBuilder()
: meta_index_block_(
new BlockBuilder(1 /* restart interval */, BytewiseComparator())) {
}
: meta_index_block_(new BlockBuilder(1 /* restart interval */)) {}
void MetaIndexBuilder::Add(const std::string& key,
const BlockHandle& handle) {
@ -35,9 +33,7 @@ Slice MetaIndexBuilder::Finish() {
}
PropertyBlockBuilder::PropertyBlockBuilder()
: properties_block_(
new BlockBuilder(1 /* restart interval */, BytewiseComparator())) {
}
: properties_block_(new BlockBuilder(1 /* restart interval */)) {}
void PropertyBlockBuilder::Add(const std::string& name,
const std::string& val) {

View file

@ -244,8 +244,7 @@ class BlockConstructor: public Constructor {
const KVMap& data) {
delete block_;
block_ = nullptr;
BlockBuilder builder(table_options.block_restart_interval,
&internal_comparator);
BlockBuilder builder(table_options.block_restart_interval);
for (KVMap::const_iterator it = data.begin();
it != data.end();
@ -1054,7 +1053,7 @@ TEST(BlockBasedTableTest, BasicBlockBasedTableProperties) {
ASSERT_EQ("", props.filter_policy_name); // no filter policy is used
// Verify data size.
BlockBuilder block_builder(1, options.comparator);
BlockBuilder block_builder(1);
for (const auto& item : kvmap) {
block_builder.Add(item.first, item.second);
}