From 03b432d4b823004d3ee0a717dd9e4bcf026d5f6e Mon Sep 17 00:00:00 2001 From: Igor Sugak Date: Thu, 26 Feb 2015 14:19:51 -0800 Subject: [PATCH] rocksdb: Fix uninitialized use error Summary: When using latest clang (3.6 or 3.7/trunck) rocksdb is failing with many errors. Some errors are uninitialized use errors. ``` ... CC db/log_test.o util/ldb_cmd.cc:394:16: error: base class 'rocksdb::LDBCommand' is uninitialized when used here to access 'rocksdb::LDBCommand::BuildCmdLineOptions' [-Werror,-Wuninitialized] BuildCmdLineOptions({ARG_FROM, ARG_TO, ARG_HEX, ARG_KEY_HEX, ^ ... ``` ```lang=c++ CompactorCommand::CompactorCommand(const vector& params, const map& options, const vector& flags) : LDBCommand(options, flags, false, BuildCmdLineOptions({ARG_FROM, ARG_TO, ARG_HEX, ARG_KEY_HEX, ARG_VALUE_HEX, ARG_TTL})), null_from_(true), null_to_(true) { . . . } ``` For the fourth parameter of the base constructor (`LDBCommand`) we call `BuildCmdLineOptions`, which is a private non-static method of `LDBCommand` base class. This diff adds missing `static` keyword for `LDBCommand::BuildCmdLineOptions` method. Test Plan: Build with trunk clang and make sure all tests are passing. ```lang=bash % # Have trunk clang present in path. % ROCKSDB_NO_FBCODE=1 CC=clang CXX=clang++ make check `` Reviewers: meyering, sdong, rven, igor Reviewed By: igor Subscribers: dhruba, leveldb Differential Revision: https://reviews.facebook.net/D34083 --- util/ldb_cmd.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/ldb_cmd.h b/util/ldb_cmd.h index a96966bd6..3df4a6c0b 100644 --- a/util/ldb_cmd.h +++ b/util/ldb_cmd.h @@ -290,7 +290,7 @@ protected: * used by this command. It includes the common options and the ones * passed in. */ - vector BuildCmdLineOptions(vector options) { + static vector BuildCmdLineOptions(vector options) { vector ret = {ARG_DB, ARG_BLOOM_BITS, ARG_BLOCK_SIZE, ARG_AUTO_COMPACTION, ARG_COMPRESSION_TYPE, ARG_WRITE_BUFFER_SIZE,