use -Werror=missing-field-initializers, to closer match MyRocks build

Summary:
myrocks seems to build rocksdb using
-Wmissing-field-initializers (and treats warnings as errors).  This diff
adds that flag to the rocksdb build, and fixes the compilation failures
that result.  I have not checked for any other differences in the build
flags for rocksdb build as part of myrocks.

Test Plan: make check

Reviewers: sdong, rven

Reviewed By: rven

Subscribers: dhruba

Differential Revision: https://reviews.facebook.net/D52443
This commit is contained in:
Nathan Bronson 2015-12-30 05:49:06 -08:00
parent ab5a9a66d2
commit ac16663bd6
7 changed files with 11 additions and 9 deletions

View file

@ -192,7 +192,7 @@ ifndef DISABLE_WARNING_AS_ERROR
endif endif
CFLAGS += $(WARNING_FLAGS) -I. -I./include $(PLATFORM_CCFLAGS) $(OPT) CFLAGS += $(WARNING_FLAGS) -I. -I./include $(PLATFORM_CCFLAGS) $(OPT)
CXXFLAGS += $(WARNING_FLAGS) -I. -I./include $(PLATFORM_CXXFLAGS) $(OPT) -Woverloaded-virtual -Wnon-virtual-dtor -Wno-missing-field-initializers CXXFLAGS += $(WARNING_FLAGS) -I. -I./include $(PLATFORM_CXXFLAGS) $(OPT) -Woverloaded-virtual -Wnon-virtual-dtor -Werror=missing-field-initializers
LDFLAGS += $(PLATFORM_LDFLAGS) LDFLAGS += $(PLATFORM_LDFLAGS)

View file

@ -1990,10 +1990,10 @@ TEST_F(ColumnFamilyTest, FlushAndDropRaceCondition) {
Reopen({options, options}); Reopen({options, options});
rocksdb::SyncPoint::GetInstance()->LoadDependency( rocksdb::SyncPoint::GetInstance()->LoadDependency(
{{"VersionSet::LogAndApply::ColumnFamilyDrop:1" {{"VersionSet::LogAndApply::ColumnFamilyDrop:1",
"FlushJob::InstallResults"}, "FlushJob::InstallResults"},
{"FlushJob::InstallResults", {"FlushJob::InstallResults",
"VersionSet::LogAndApply::ColumnFamilyDrop:2", }}); "VersionSet::LogAndApply::ColumnFamilyDrop:2"}});
rocksdb::SyncPoint::GetInstance()->EnableProcessing(); rocksdb::SyncPoint::GetInstance()->EnableProcessing();
test::SleepingBackgroundTask sleeping_task; test::SleepingBackgroundTask sleeping_task;

View file

@ -4383,7 +4383,7 @@ Status DBImpl::WriteImpl(const WriteOptions& write_options,
&flush_scheduler_, write_options.ignore_missing_column_families, &flush_scheduler_, write_options.ignore_missing_column_families,
0 /*log_number*/, this, false /*dont_filter_deletes*/); 0 /*log_number*/, this, false /*dont_filter_deletes*/);
} else { } else {
WriteThread::ParallelGroup pg{}; WriteThread::ParallelGroup pg;
pg.leader = &w; pg.leader = &w;
pg.last_writer = last_writer; pg.last_writer = last_writer;
pg.early_exit_allowed = !need_log_sync; pg.early_exit_allowed = !need_log_sync;

View file

@ -5653,7 +5653,7 @@ TEST_F(DBTest, GroupCommitTest) {
ASSERT_TRUE(!itr->Valid()); ASSERT_TRUE(!itr->Valid());
delete itr; delete itr;
HistogramData hist_data = {0}; HistogramData hist_data = {0, 0, 0, 0, 0};
options.statistics->histogramData(DB_WRITE, &hist_data); options.statistics->histogramData(DB_WRITE, &hist_data);
ASSERT_GT(hist_data.average, 0.0); ASSERT_GT(hist_data.average, 0.0);
} while (ChangeOptions(kSkipNoSeekToLast)); } while (ChangeOptions(kSkipNoSeekToLast));

View file

@ -213,7 +213,7 @@ void WriteThread::CreateMissingNewerLinks(Writer* head) {
} }
void WriteThread::JoinBatchGroup(Writer* w) { void WriteThread::JoinBatchGroup(Writer* w) {
static AdaptationContext ctx{"JoinBatchGroup"}; static AdaptationContext ctx("JoinBatchGroup");
assert(w->batch != nullptr); assert(w->batch != nullptr);
bool linked_as_leader; bool linked_as_leader;
@ -323,7 +323,7 @@ void WriteThread::LaunchParallelFollowers(ParallelGroup* pg,
} }
bool WriteThread::CompleteParallelWorker(Writer* w) { bool WriteThread::CompleteParallelWorker(Writer* w) {
static AdaptationContext ctx{"CompleteParallelWorker"}; static AdaptationContext ctx("CompleteParallelWorker");
auto* pg = w->parallel_group; auto* pg = w->parallel_group;
if (!w->status.ok()) { if (!w->status.ok()) {
@ -419,7 +419,7 @@ void WriteThread::ExitAsBatchGroupLeader(Writer* leader, Writer* last_writer,
} }
void WriteThread::EnterUnbatched(Writer* w, InstrumentedMutex* mu) { void WriteThread::EnterUnbatched(Writer* w, InstrumentedMutex* mu) {
static AdaptationContext ctx{"EnterUnbatched"}; static AdaptationContext ctx("EnterUnbatched");
assert(w->batch == nullptr); assert(w->batch == nullptr);
bool linked_as_leader; bool linked_as_leader;

View file

@ -207,6 +207,8 @@ class WriteThread {
struct AdaptationContext { struct AdaptationContext {
const char* name; const char* name;
std::atomic<int32_t> value; std::atomic<int32_t> value;
explicit AdaptationContext(const char* name0) : name(name0), value(0) {}
}; };
private: private:

View file

@ -1998,7 +1998,7 @@ TEST_F(HarnessTest, Randomized) {
#ifndef ROCKSDB_LITE #ifndef ROCKSDB_LITE
TEST_F(HarnessTest, RandomizedLongDB) { TEST_F(HarnessTest, RandomizedLongDB) {
Random rnd(test::RandomSeed()); Random rnd(test::RandomSeed());
TestArgs args = { DB_TEST, false, 16, kNoCompression, 0 }; TestArgs args = {DB_TEST, false, 16, kNoCompression, 0, false};
Init(args); Init(args);
int num_entries = 100000; int num_entries = 100000;
for (int e = 0; e < num_entries; e++) { for (int e = 0; e < num_entries; e++) {