From 594e815e32d5ea62857026eda5ebd4f6fc76f0da Mon Sep 17 00:00:00 2001 From: sdong Date: Mon, 10 Feb 2020 15:42:23 -0800 Subject: [PATCH] Make clang analyze happy with options_test (#6398) Summary: clang analysis shows following warning: options/options_test.cc:1554:24: warning: The left operand of '-' is a garbage value (file_size - 1) / readahead_size + 1); ~~~~~~~~~ ^ Explicitly initialize file_size and add an assertion to make clang analysis happy. Pull Request resolved: https://github.com/facebook/rocksdb/pull/6398 Test Plan: Run "make analysis" and see the warning goes away. Differential Revision: D19819662 fbshipit-source-id: 1589ea91c0c8f78242538f01448e4ad0e5fbc219 --- options/options_test.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/options/options_test.cc b/options/options_test.cc index 4fd6c9e9a..5078afd3c 100644 --- a/options/options_test.cc +++ b/options/options_test.cc @@ -1541,9 +1541,10 @@ TEST_F(OptionsParserTest, Readahead) { ASSERT_OK(PersistRocksDBOptions(base_db_opt, cf_names, base_cf_opts, kOptionsFileName, fs_.get())); - uint64_t file_size; + uint64_t file_size = 0; ASSERT_OK(env_->GetFileSize(kOptionsFileName, &file_size)); - + assert(file_size > 0); + RocksDBOptionsParser parser; env_->num_seq_file_read_ = 0;