fix gflags namespace

Summary:
I started adding gflags support for cmake on linux and got frustrated that I'd need to duplicate the build_detect_platform logic, which determines namespace based on attempting compilation. We can do it differently -- use the GFLAGS_NAMESPACE macro if available, and if not, that indicates it's an old gflags version without configurable namespace so we can simply hardcode "google".
Closes https://github.com/facebook/rocksdb/pull/3212

Differential Revision: D6456973

Pulled By: ajkr

fbshipit-source-id: 3e6d5bde3ca00d4496a120a7caf4687399f5d656
main
Andrew Kryczka 7 years ago committed by Facebook Github Bot
parent 18dcf7f98d
commit 63f1c0a57d
  1. 14
      build_tools/build_detect_platform
  2. 8
      cache/cache_bench.cc
  3. 6
      db/forward_iterator_bench.cc
  4. 6
      db/prefix_test.cc
  5. 9
      memtable/memtablerep_bench.cc
  6. 4
      options/options_settable_test.cc
  7. 4
      options/options_test.cc
  8. 10
      table/cuckoo_table_reader_test.cc
  9. 7
      table/table_reader_bench.cc
  10. 8
      tools/db_bench_tool.cc
  11. 2
      tools/db_bench_tool_test.cc
  12. 7
      tools/db_repl_stress.cc
  13. 8
      tools/db_stress.cc
  14. 4
      tools/dump/rocksdb_dump.cc
  15. 4
      tools/dump/rocksdb_undump.cc
  16. 9
      tools/write_stress.cc
  17. 4
      util/bloom_test.cc
  18. 6
      util/dynamic_bloom_test.cc
  19. 12
      util/gflags_compat.h
  20. 4
      util/heap_test.cc
  21. 7
      util/log_write_bench.cc
  22. 4
      utilities/column_aware_encoding_exp.cc
  23. 4
      utilities/options/options_util_test.cc
  24. 8
      utilities/persistent_cache/hash_table_bench.cc
  25. 8
      utilities/persistent_cache/persistent_cache_bench.cc

@ -227,23 +227,11 @@ EOF
# check if the namespace is gflags # check if the namespace is gflags
$CXX $CFLAGS -x c++ - -o /dev/null 2>/dev/null << EOF $CXX $CFLAGS -x c++ - -o /dev/null 2>/dev/null << EOF
#include <gflags/gflags.h> #include <gflags/gflags.h>
using namespace gflags;
int main() {} int main() {}
EOF EOF
if [ "$?" = 0 ]; then if [ "$?" = 0 ]; then
COMMON_FLAGS="$COMMON_FLAGS -DGFLAGS=gflags" COMMON_FLAGS="$COMMON_FLAGS -DGFLAGS=1"
PLATFORM_LDFLAGS="$PLATFORM_LDFLAGS -lgflags" PLATFORM_LDFLAGS="$PLATFORM_LDFLAGS -lgflags"
else
# check if namespace is google
$CXX $CFLAGS -x c++ - -o /dev/null 2>/dev/null << EOF
#include <gflags/gflags.h>
using namespace google;
int main() {}
EOF
if [ "$?" = 0 ]; then
COMMON_FLAGS="$COMMON_FLAGS -DGFLAGS=google"
PLATFORM_LDFLAGS="$PLATFORM_LDFLAGS -lgflags"
fi
fi fi
# Test whether zlib library is installed # Test whether zlib library is installed

@ -17,16 +17,16 @@ int main() {
#include <inttypes.h> #include <inttypes.h>
#include <sys/types.h> #include <sys/types.h>
#include <stdio.h> #include <stdio.h>
#include <gflags/gflags.h>
#include "rocksdb/db.h" #include "port/port.h"
#include "rocksdb/cache.h" #include "rocksdb/cache.h"
#include "rocksdb/db.h"
#include "rocksdb/env.h" #include "rocksdb/env.h"
#include "port/port.h" #include "util/gflags_compat.h"
#include "util/mutexlock.h" #include "util/mutexlock.h"
#include "util/random.h" #include "util/random.h"
using GFLAGS::ParseCommandLineFlags; using GFLAGS_NAMESPACE::ParseCommandLineFlags;
static const uint32_t KB = 1024; static const uint32_t KB = 1024;

@ -17,7 +17,6 @@ int main() {
// Block forward_iterator_bench under MAC and Windows // Block forward_iterator_bench under MAC and Windows
int main() { return 0; } int main() { return 0; }
#else #else
#include <gflags/gflags.h>
#include <semaphore.h> #include <semaphore.h>
#include <atomic> #include <atomic>
#include <bitset> #include <bitset>
@ -30,11 +29,12 @@ int main() { return 0; }
#include <random> #include <random>
#include <thread> #include <thread>
#include "port/port.h"
#include "rocksdb/cache.h" #include "rocksdb/cache.h"
#include "rocksdb/db.h" #include "rocksdb/db.h"
#include "rocksdb/status.h" #include "rocksdb/status.h"
#include "rocksdb/table.h" #include "rocksdb/table.h"
#include "port/port.h" #include "util/gflags_compat.h"
#include "util/testharness.h" #include "util/testharness.h"
const int MAX_SHARDS = 100000; const int MAX_SHARDS = 100000;
@ -319,7 +319,7 @@ struct StatsThread {
}; };
int main(int argc, char** argv) { int main(int argc, char** argv) {
GFLAGS::ParseCommandLineFlags(&argc, &argv, true); GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true);
std::mt19937 rng{std::random_device()()}; std::mt19937 rng{std::random_device()()};
rocksdb::Status status; rocksdb::Status status;

@ -17,7 +17,6 @@ int main() {
#include <iostream> #include <iostream>
#include <vector> #include <vector>
#include <gflags/gflags.h>
#include "db/db_impl.h" #include "db/db_impl.h"
#include "monitoring/histogram.h" #include "monitoring/histogram.h"
#include "rocksdb/comparator.h" #include "rocksdb/comparator.h"
@ -27,14 +26,15 @@ int main() {
#include "rocksdb/perf_context.h" #include "rocksdb/perf_context.h"
#include "rocksdb/slice_transform.h" #include "rocksdb/slice_transform.h"
#include "rocksdb/table.h" #include "rocksdb/table.h"
#include "util/coding.h"
#include "util/gflags_compat.h"
#include "util/random.h" #include "util/random.h"
#include "util/stop_watch.h" #include "util/stop_watch.h"
#include "util/string_util.h" #include "util/string_util.h"
#include "util/testharness.h" #include "util/testharness.h"
#include "utilities/merge_operators.h" #include "utilities/merge_operators.h"
#include "util/coding.h"
using GFLAGS::ParseCommandLineFlags; using GFLAGS_NAMESPACE::ParseCommandLineFlags;
DEFINE_bool(trigger_deadlock, false, DEFINE_bool(trigger_deadlock, false,
"issue delete in range scan to trigger PrefixHashMap deadlock"); "issue delete in range scan to trigger PrefixHashMap deadlock");

@ -19,8 +19,6 @@ int main() {
} }
#else #else
#include <gflags/gflags.h>
#include <atomic> #include <atomic>
#include <iostream> #include <iostream>
#include <memory> #include <memory>
@ -38,13 +36,14 @@ int main() {
#include "rocksdb/slice_transform.h" #include "rocksdb/slice_transform.h"
#include "rocksdb/write_buffer_manager.h" #include "rocksdb/write_buffer_manager.h"
#include "util/arena.h" #include "util/arena.h"
#include "util/gflags_compat.h"
#include "util/mutexlock.h" #include "util/mutexlock.h"
#include "util/stop_watch.h" #include "util/stop_watch.h"
#include "util/testutil.h" #include "util/testutil.h"
using GFLAGS::ParseCommandLineFlags; using GFLAGS_NAMESPACE::ParseCommandLineFlags;
using GFLAGS::RegisterFlagValidator; using GFLAGS_NAMESPACE::RegisterFlagValidator;
using GFLAGS::SetUsageMessage; using GFLAGS_NAMESPACE::SetUsageMessage;
DEFINE_string(benchmarks, "fillrandom", DEFINE_string(benchmarks, "fillrandom",
"Comma-separated list of benchmarks to run. Options:\n" "Comma-separated list of benchmarks to run. Options:\n"

@ -20,8 +20,8 @@
#ifndef GFLAGS #ifndef GFLAGS
bool FLAGS_enable_print = false; bool FLAGS_enable_print = false;
#else #else
#include <gflags/gflags.h> #include "util/gflags_compat.h"
using GFLAGS::ParseCommandLineFlags; using GFLAGS_NAMESPACE::ParseCommandLineFlags;
DEFINE_bool(enable_print, false, "Print options generated to console."); DEFINE_bool(enable_print, false, "Print options generated to console.");
#endif // GFLAGS #endif // GFLAGS

@ -34,8 +34,8 @@
#ifndef GFLAGS #ifndef GFLAGS
bool FLAGS_enable_print = false; bool FLAGS_enable_print = false;
#else #else
#include <gflags/gflags.h> #include "util/gflags_compat.h"
using GFLAGS::ParseCommandLineFlags; using GFLAGS_NAMESPACE::ParseCommandLineFlags;
DEFINE_bool(enable_print, false, "Print options generated to console."); DEFINE_bool(enable_print, false, "Print options generated to console.");
#endif // GFLAGS #endif // GFLAGS

@ -18,24 +18,24 @@ int main() {
#endif #endif
#include <inttypes.h> #include <inttypes.h>
#include <gflags/gflags.h>
#include <vector> #include <vector>
#include <string> #include <string>
#include <map> #include <map>
#include "table/meta_blocks.h"
#include "table/cuckoo_table_builder.h" #include "table/cuckoo_table_builder.h"
#include "table/cuckoo_table_reader.h"
#include "table/cuckoo_table_factory.h" #include "table/cuckoo_table_factory.h"
#include "table/cuckoo_table_reader.h"
#include "table/get_context.h" #include "table/get_context.h"
#include "table/meta_blocks.h"
#include "util/arena.h" #include "util/arena.h"
#include "util/gflags_compat.h"
#include "util/random.h" #include "util/random.h"
#include "util/string_util.h" #include "util/string_util.h"
#include "util/testharness.h" #include "util/testharness.h"
#include "util/testutil.h" #include "util/testutil.h"
using GFLAGS::ParseCommandLineFlags; using GFLAGS_NAMESPACE::ParseCommandLineFlags;
using GFLAGS::SetUsageMessage; using GFLAGS_NAMESPACE::SetUsageMessage;
DEFINE_string(file_dir, "", "Directory where the files will be created" DEFINE_string(file_dir, "", "Directory where the files will be created"
" for benchmark. Added for using tmpfs."); " for benchmark. Added for using tmpfs.");

@ -11,8 +11,6 @@ int main() {
} }
#else #else
#include <gflags/gflags.h>
#include "db/db_impl.h" #include "db/db_impl.h"
#include "db/dbformat.h" #include "db/dbformat.h"
#include "monitoring/histogram.h" #include "monitoring/histogram.h"
@ -25,11 +23,12 @@ int main() {
#include "table/plain_table_factory.h" #include "table/plain_table_factory.h"
#include "table/table_builder.h" #include "table/table_builder.h"
#include "util/file_reader_writer.h" #include "util/file_reader_writer.h"
#include "util/gflags_compat.h"
#include "util/testharness.h" #include "util/testharness.h"
#include "util/testutil.h" #include "util/testutil.h"
using GFLAGS::ParseCommandLineFlags; using GFLAGS_NAMESPACE::ParseCommandLineFlags;
using GFLAGS::SetUsageMessage; using GFLAGS_NAMESPACE::SetUsageMessage;
namespace rocksdb { namespace rocksdb {

@ -20,7 +20,6 @@
#include <unistd.h> #include <unistd.h>
#endif #endif
#include <fcntl.h> #include <fcntl.h>
#include <gflags/gflags.h>
#include <inttypes.h> #include <inttypes.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -61,6 +60,7 @@
#include "util/cast_util.h" #include "util/cast_util.h"
#include "util/compression.h" #include "util/compression.h"
#include "util/crc32c.h" #include "util/crc32c.h"
#include "util/gflags_compat.h"
#include "util/mutexlock.h" #include "util/mutexlock.h"
#include "util/random.h" #include "util/random.h"
#include "util/stderr_logger.h" #include "util/stderr_logger.h"
@ -76,9 +76,9 @@
#include <io.h> // open/close #include <io.h> // open/close
#endif #endif
using GFLAGS::ParseCommandLineFlags; using GFLAGS_NAMESPACE::ParseCommandLineFlags;
using GFLAGS::RegisterFlagValidator; using GFLAGS_NAMESPACE::RegisterFlagValidator;
using GFLAGS::SetUsageMessage; using GFLAGS_NAMESPACE::SetUsageMessage;
DEFINE_string( DEFINE_string(
benchmarks, benchmarks,

@ -15,7 +15,7 @@
#include "util/testutil.h" #include "util/testutil.h"
#ifdef GFLAGS #ifdef GFLAGS
#include <gflags/gflags.h> #include "util/gflags_compat.h"
namespace rocksdb { namespace rocksdb {
namespace { namespace {

@ -15,11 +15,10 @@ int main() {
#include <cstdio> #include <cstdio>
#include <atomic> #include <atomic>
#include <gflags/gflags.h>
#include "db/write_batch_internal.h" #include "db/write_batch_internal.h"
#include "rocksdb/db.h" #include "rocksdb/db.h"
#include "rocksdb/types.h" #include "rocksdb/types.h"
#include "util/gflags_compat.h"
#include "util/testutil.h" #include "util/testutil.h"
// Run a thread to perform Put's. // Run a thread to perform Put's.
@ -30,8 +29,8 @@ int main() {
using namespace rocksdb; using namespace rocksdb;
using GFLAGS::ParseCommandLineFlags; using GFLAGS_NAMESPACE::ParseCommandLineFlags;
using GFLAGS::SetUsageMessage; using GFLAGS_NAMESPACE::SetUsageMessage;
struct DataPumpThread { struct DataPumpThread {
size_t no_records; size_t no_records;

@ -39,7 +39,6 @@ int main() {
#include <exception> #include <exception>
#include <thread> #include <thread>
#include <gflags/gflags.h>
#include "db/db_impl.h" #include "db/db_impl.h"
#include "db/version_set.h" #include "db/version_set.h"
#include "hdfs/env_hdfs.h" #include "hdfs/env_hdfs.h"
@ -56,6 +55,7 @@ int main() {
#include "util/coding.h" #include "util/coding.h"
#include "util/compression.h" #include "util/compression.h"
#include "util/crc32c.h" #include "util/crc32c.h"
#include "util/gflags_compat.h"
#include "util/logging.h" #include "util/logging.h"
#include "util/mutexlock.h" #include "util/mutexlock.h"
#include "util/random.h" #include "util/random.h"
@ -68,9 +68,9 @@ int main() {
#include "utilities/merge_operators.h" #include "utilities/merge_operators.h"
using GFLAGS::ParseCommandLineFlags; using GFLAGS_NAMESPACE::ParseCommandLineFlags;
using GFLAGS::RegisterFlagValidator; using GFLAGS_NAMESPACE::RegisterFlagValidator;
using GFLAGS::SetUsageMessage; using GFLAGS_NAMESPACE::SetUsageMessage;
static const long KB = 1024; static const long KB = 1024;
static const int kRandomValueMaxFactor = 3; static const int kRandomValueMaxFactor = 3;

@ -18,9 +18,9 @@ int main() {
#else #else
#include <gflags/gflags.h>
#include "rocksdb/convenience.h" #include "rocksdb/convenience.h"
#include "rocksdb/db_dump_tool.h" #include "rocksdb/db_dump_tool.h"
#include "util/gflags_compat.h"
DEFINE_string(db_path, "", "Path to the db that will be dumped"); DEFINE_string(db_path, "", "Path to the db that will be dumped");
DEFINE_string(dump_location, "", "Path to where the dump file location"); DEFINE_string(dump_location, "", "Path to where the dump file location");
@ -30,7 +30,7 @@ DEFINE_string(db_options, "",
"Options string used to open the database that will be dumped"); "Options string used to open the database that will be dumped");
int main(int argc, char** argv) { int main(int argc, char** argv) {
GFLAGS::ParseCommandLineFlags(&argc, &argv, true); GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true);
if (FLAGS_db_path == "" || FLAGS_dump_location == "") { if (FLAGS_db_path == "" || FLAGS_dump_location == "") {
fprintf(stderr, "Please set --db_path and --dump_location\n"); fprintf(stderr, "Please set --db_path and --dump_location\n");

@ -18,9 +18,9 @@ int main() {
#else #else
#include <gflags/gflags.h>
#include "rocksdb/convenience.h" #include "rocksdb/convenience.h"
#include "rocksdb/db_dump_tool.h" #include "rocksdb/db_dump_tool.h"
#include "util/gflags_compat.h"
DEFINE_string(dump_location, "", "Path to the dump file that will be loaded"); DEFINE_string(dump_location, "", "Path to the dump file that will be loaded");
DEFINE_string(db_path, "", "Path to the db that we will undump the file into"); DEFINE_string(db_path, "", "Path to the db that we will undump the file into");
@ -29,7 +29,7 @@ DEFINE_string(db_options, "",
"Options string used to open the database that will be loaded"); "Options string used to open the database that will be loaded");
int main(int argc, char **argv) { int main(int argc, char **argv) {
GFLAGS::ParseCommandLineFlags(&argc, &argv, true); GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true);
if (FLAGS_db_path == "" || FLAGS_dump_location == "") { if (FLAGS_db_path == "" || FLAGS_dump_location == "") {
fprintf(stderr, "Please set --db_path and --dump_location\n"); fprintf(stderr, "Please set --db_path and --dump_location\n");

@ -56,8 +56,6 @@ int main() {
} }
#else #else
#include <gflags/gflags.h>
#define __STDC_FORMAT_MACROS #define __STDC_FORMAT_MACROS
#include <inttypes.h> #include <inttypes.h>
#include <atomic> #include <atomic>
@ -72,10 +70,11 @@ int main() {
#include "rocksdb/options.h" #include "rocksdb/options.h"
#include "rocksdb/slice.h" #include "rocksdb/slice.h"
#include "util/filename.h" #include "util/filename.h"
#include "util/gflags_compat.h"
using GFLAGS::ParseCommandLineFlags; using GFLAGS_NAMESPACE::ParseCommandLineFlags;
using GFLAGS::RegisterFlagValidator; using GFLAGS_NAMESPACE::RegisterFlagValidator;
using GFLAGS::SetUsageMessage; using GFLAGS_NAMESPACE::SetUsageMessage;
DEFINE_int32(key_size, 10, "Key size"); DEFINE_int32(key_size, 10, "Key size");
DEFINE_int32(value_size, 100, "Value size"); DEFINE_int32(value_size, 100, "Value size");

@ -15,17 +15,17 @@ int main() {
} }
#else #else
#include <gflags/gflags.h>
#include <vector> #include <vector>
#include "rocksdb/filter_policy.h" #include "rocksdb/filter_policy.h"
#include "table/full_filter_bits_builder.h" #include "table/full_filter_bits_builder.h"
#include "util/arena.h" #include "util/arena.h"
#include "util/gflags_compat.h"
#include "util/logging.h" #include "util/logging.h"
#include "util/testharness.h" #include "util/testharness.h"
#include "util/testutil.h" #include "util/testutil.h"
using GFLAGS::ParseCommandLineFlags; using GFLAGS_NAMESPACE::ParseCommandLineFlags;
DEFINE_int32(bits_per_key, 10, ""); DEFINE_int32(bits_per_key, 10, "");

@ -15,7 +15,6 @@ int main() {
#define __STDC_FORMAT_MACROS #define __STDC_FORMAT_MACROS
#endif #endif
#include <gflags/gflags.h>
#include <inttypes.h> #include <inttypes.h>
#include <algorithm> #include <algorithm>
#include <atomic> #include <atomic>
@ -27,12 +26,13 @@ int main() {
#include "dynamic_bloom.h" #include "dynamic_bloom.h"
#include "port/port.h" #include "port/port.h"
#include "util/arena.h" #include "util/arena.h"
#include "util/gflags_compat.h"
#include "util/logging.h" #include "util/logging.h"
#include "util/stop_watch.h"
#include "util/testharness.h" #include "util/testharness.h"
#include "util/testutil.h" #include "util/testutil.h"
#include "util/stop_watch.h"
using GFLAGS::ParseCommandLineFlags; using GFLAGS_NAMESPACE::ParseCommandLineFlags;
DEFINE_int32(bits_per_key, 10, ""); DEFINE_int32(bits_per_key, 10, "");
DEFINE_int32(num_probes, 6, ""); DEFINE_int32(num_probes, 6, "");

@ -0,0 +1,12 @@
// Copyright (c) 2017-present, Facebook, Inc. All rights reserved.
// This source code is licensed under both the GPLv2 (found in the
// COPYING file in the root directory) and Apache 2.0 License
// (found in the LICENSE.Apache file in the root directory).
#include <gflags/gflags.h>
#ifndef GFLAGS_NAMESPACE
// in case it's not defined in old versions, that's probably because it was
// still google by default.
#define GFLAGS_NAMESPACE google
#endif

@ -16,7 +16,7 @@
#ifndef GFLAGS #ifndef GFLAGS
const int64_t FLAGS_iters = 100000; const int64_t FLAGS_iters = 100000;
#else #else
#include <gflags/gflags.h> #include "util/gflags_compat.h"
DEFINE_int64(iters, 100000, "number of pseudo-random operations in each test"); DEFINE_int64(iters, 100000, "number of pseudo-random operations in each test");
#endif // GFLAGS #endif // GFLAGS
@ -133,7 +133,7 @@ INSTANTIATE_TEST_CASE_P(
int main(int argc, char** argv) { int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv); ::testing::InitGoogleTest(&argc, argv);
#ifdef GFLAGS #ifdef GFLAGS
GFLAGS::ParseCommandLineFlags(&argc, &argv, true); GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, true);
#endif // GFLAGS #endif // GFLAGS
return RUN_ALL_TESTS(); return RUN_ALL_TESTS();
} }

@ -11,16 +11,15 @@ int main() {
} }
#else #else
#include <gflags/gflags.h>
#include "monitoring/histogram.h" #include "monitoring/histogram.h"
#include "rocksdb/env.h" #include "rocksdb/env.h"
#include "util/file_reader_writer.h" #include "util/file_reader_writer.h"
#include "util/gflags_compat.h"
#include "util/testharness.h" #include "util/testharness.h"
#include "util/testutil.h" #include "util/testutil.h"
using GFLAGS::ParseCommandLineFlags; using GFLAGS_NAMESPACE::ParseCommandLineFlags;
using GFLAGS::SetUsageMessage; using GFLAGS_NAMESPACE::SetUsageMessage;
// A simple benchmark to simulate transactional logs // A simple benchmark to simulate transactional logs

@ -13,7 +13,6 @@
#ifndef ROCKSDB_LITE #ifndef ROCKSDB_LITE
#ifdef GFLAGS #ifdef GFLAGS
#include <gflags/gflags.h>
#include <inttypes.h> #include <inttypes.h>
#include <vector> #include <vector>
#include "rocksdb/env.h" #include "rocksdb/env.h"
@ -23,11 +22,12 @@
#include "table/format.h" #include "table/format.h"
#include "tools/sst_dump_tool_imp.h" #include "tools/sst_dump_tool_imp.h"
#include "util/compression.h" #include "util/compression.h"
#include "util/gflags_compat.h"
#include "util/stop_watch.h" #include "util/stop_watch.h"
#include "utilities/col_buf_encoder.h" #include "utilities/col_buf_encoder.h"
#include "utilities/column_aware_encoding_util.h" #include "utilities/column_aware_encoding_util.h"
using GFLAGS::ParseCommandLineFlags; using GFLAGS_NAMESPACE::ParseCommandLineFlags;
DEFINE_string(encoded_file, "", "file to store encoded data blocks"); DEFINE_string(encoded_file, "", "file to store encoded data blocks");
DEFINE_string(decoded_file, "", DEFINE_string(decoded_file, "",
"file to store decoded data blocks after encoding"); "file to store decoded data blocks after encoding");

@ -24,8 +24,8 @@
#ifndef GFLAGS #ifndef GFLAGS
bool FLAGS_enable_print = false; bool FLAGS_enable_print = false;
#else #else
#include <gflags/gflags.h> #include "util/gflags_compat.h"
using GFLAGS::ParseCommandLineFlags; using GFLAGS_NAMESPACE::ParseCommandLineFlags;
DEFINE_bool(enable_print, false, "Print options generated to console."); DEFINE_bool(enable_print, false, "Print options generated to console.");
#endif // GFLAGS #endif // GFLAGS

@ -10,7 +10,6 @@
#include <cstdio> #include <cstdio>
int main() { fprintf(stderr, "Please install gflags to run tools\n"); } int main() { fprintf(stderr, "Please install gflags to run tools\n"); }
#else #else
#include <gflags/gflags.h>
#include <atomic> #include <atomic>
#include <functional> #include <functional>
@ -19,6 +18,7 @@ int main() { fprintf(stderr, "Please install gflags to run tools\n"); }
#include "port/port_posix.h" #include "port/port_posix.h"
#include "rocksdb/env.h" #include "rocksdb/env.h"
#include "util/gflags_compat.h"
#include "util/mutexlock.h" #include "util/mutexlock.h"
#include "utilities/persistent_cache/hash_table.h" #include "utilities/persistent_cache/hash_table.h"
@ -272,9 +272,9 @@ class GranularLockImpl : public HashTableImpl<size_t, string> {
// main // main
// //
int main(int argc, char** argv) { int main(int argc, char** argv) {
GFLAGS::SetUsageMessage(std::string("\nUSAGE:\n") + std::string(argv[0]) + GFLAGS_NAMESPACE::SetUsageMessage(std::string("\nUSAGE:\n") +
" [OPTIONS]..."); std::string(argv[0]) + " [OPTIONS]...");
GFLAGS::ParseCommandLineFlags(&argc, &argv, false); GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, false);
// //
// Micro benchmark unordered_map // Micro benchmark unordered_map

@ -9,7 +9,6 @@
#include <cstdio> #include <cstdio>
int main() { fprintf(stderr, "Please install gflags to run tools\n"); } int main() { fprintf(stderr, "Please install gflags to run tools\n"); }
#else #else
#include <gflags/gflags.h>
#include <atomic> #include <atomic>
#include <functional> #include <functional>
#include <memory> #include <memory>
@ -25,6 +24,7 @@ int main() { fprintf(stderr, "Please install gflags to run tools\n"); }
#include "monitoring/histogram.h" #include "monitoring/histogram.h"
#include "port/port.h" #include "port/port.h"
#include "table/block_builder.h" #include "table/block_builder.h"
#include "util/gflags_compat.h"
#include "util/mutexlock.h" #include "util/mutexlock.h"
#include "util/stop_watch.h" #include "util/stop_watch.h"
@ -307,9 +307,9 @@ class CacheTierBenchmark {
// main // main
// //
int main(int argc, char** argv) { int main(int argc, char** argv) {
GFLAGS::SetUsageMessage(std::string("\nUSAGE:\n") + std::string(argv[0]) + GFLAGS_NAMESPACE::SetUsageMessage(std::string("\nUSAGE:\n") +
" [OPTIONS]..."); std::string(argv[0]) + " [OPTIONS]...");
GFLAGS::ParseCommandLineFlags(&argc, &argv, false); GFLAGS_NAMESPACE::ParseCommandLineFlags(&argc, &argv, false);
std::ostringstream msg; std::ostringstream msg;
msg << "Config" << std::endl msg << "Config" << std::endl

Loading…
Cancel
Save