Commit b6bfacc2 authored by Henrik Kjellander's avatar Henrik Kjellander

Roll chromium_revision 1d144ca7f86..2a818f5413 (375480:395512)

* Update gflags to newer repository location (plain copy
  from the files in WebRTC).
* Add workarounds for mojo dependency (see
  http://bugs.webrtc.org/5629 for more details).
* Update libyuv_unittest to generate user friendly
  run-scripts for Android in out/{Debug,Release}/bin
* Fix Android test execution by adding explicit dependency
  on Chromium's base/base.gyp:base_build_config_gen

This roll also solves the compile problem for Mac ASan bots.

Change log: https://chromium.googlesource.com/chromium/src/+log/1d144ca7f86..2a818f5413
Full diff: https://chromium.googlesource.com/chromium/src/+/1d144ca7f86..2a818f5413

R=magjed@chromium.org
TBR=fbarchard@chromium.org

Review URL: https://codereview.chromium.org/2001173003 .
parent 7edf572e
...@@ -10,32 +10,42 @@ pin-log.txt ...@@ -10,32 +10,42 @@ pin-log.txt
/google_apis /google_apis
/links /links
/links.db /links.db
/mojo
/native_client /native_client
/net /net
/out /out
/sde-avx-sse-transition-out.txt /sde-avx-sse-transition-out.txt
/testing /testing
/third_party/android_platform /third_party/android_platform
/third_party/android_testrunner
/third_party/android_tools /third_party/android_tools
/third_party/appurify-python /third_party/appurify-python
/third_party/asan /third_party/asan
/third_party/ashmem /third_party/ashmem
/third_party/binutils /third_party/binutils
/third_party/BUILD.gn /third_party/BUILD.gn
/third_party/catapult
/third_party/drmemory /third_party/drmemory
/third_party/gflags/src /third_party/gflags/src
/third_party/icu
/third_party/ijar
/third_party/instrumented_libraries /third_party/instrumented_libraries
/third_party/jsr-305
/third_party/junit
/third_party/libjpeg /third_party/libjpeg
/third_party/libjpeg_turbo /third_party/libjpeg_turbo
/third_party/libxml
/third_party/llvm /third_party/llvm
/third_party/llvm-build /third_party/llvm-build
/third_party/lss /third_party/lss
/third_party/mockito
/third_party/modp_b64
/third_party/protobuf /third_party/protobuf
/third_party/requests
/third_party/robolectric
/third_party/WebKit
/third_party/yasm /third_party/yasm
/tools/android /tools/android
/tools/clang /tools/clang
/tools/find_depot_tools.py
/tools/generate_library_loader /tools/generate_library_loader
/tools/gn /tools/gn
/tools/grit /tools/grit
...@@ -46,7 +56,6 @@ pin-log.txt ...@@ -46,7 +56,6 @@ pin-log.txt
/tools/memory /tools/memory
/tools/protoc_wrapper /tools/protoc_wrapper
/tools/python /tools/python
/tools/relocation_packer
/tools/sanitizer_options /tools/sanitizer_options
/tools/swarming_client /tools/swarming_client
/tools/tsan_suppressions /tools/tsan_suppressions
......
...@@ -7,14 +7,14 @@ vars = { ...@@ -7,14 +7,14 @@ vars = {
# Roll the Chromium Git hash to pick up newer versions of all the # Roll the Chromium Git hash to pick up newer versions of all the
# dependencies and tools linked to in setup_links.py. # dependencies and tools linked to in setup_links.py.
'chromium_revision': '1d144ca7f86e0c684c67d6c1b6d5414ca9074615', 'chromium_revision': '2a818f54130d8c93f81490adce5a1e87307bf5f0',
} }
# NOTE: Prefer revision numbers to tags for svn deps. Use http rather than # NOTE: Prefer revision numbers to tags for svn deps. Use http rather than
# https; the latter can cause problems for users behind proxies. # https; the latter can cause problems for users behind proxies.
deps = { deps = {
Var('root_dir') + '/third_party/gflags/src': Var('root_dir') + '/third_party/gflags/src':
Var('chromium_git') + '/external/gflags/src@e7390f9185c75f8d902c05ed7d20bb94eb914d0c', # from svn revision 82 Var('chromium_git') + '/external/github.com/gflags/gflags@03bebcb065c83beff83d50ae025a55a4bf94dfca',
} }
# Define rules for which include paths are allowed in our source. # Define rules for which include paths are allowed in our source.
......
...@@ -191,15 +191,25 @@ ...@@ -191,15 +191,25 @@
# These are used to configure java_apk.gypi included below. # These are used to configure java_apk.gypi included below.
'test_type': 'gtest', 'test_type': 'gtest',
'apk_name': 'libyuv_unittest', 'apk_name': 'libyuv_unittest',
'test_suite_name': 'libyuv_unittest',
'intermediate_dir': '<(PRODUCT_DIR)/libyuv_unittest_apk', 'intermediate_dir': '<(PRODUCT_DIR)/libyuv_unittest_apk',
'input_shlib_path': '<(SHARED_LIB_DIR)/<(SHARED_LIB_PREFIX)libyuv_unittest<(SHARED_LIB_SUFFIX)',
'final_apk_path': '<(intermediate_dir)/libyuv_unittest-debug.apk', 'final_apk_path': '<(intermediate_dir)/libyuv_unittest-debug.apk',
'java_in_dir': '<(DEPTH)/testing/android/native_test/java', 'java_in_dir': '<(DEPTH)/testing/android/native_test/java',
'test_runner_path': '<(DEPTH)/util/android/test_runner.py',
'native_lib_target': 'libyuv_unittest', 'native_lib_target': 'libyuv_unittest',
'gyp_managed_install': 0, 'gyp_managed_install': 0,
}, },
'includes': [ 'build/java_apk.gypi' ], 'includes': [
'build/android/test_runner.gypi',
'build/java_apk.gypi',
],
'dependencies': [ 'dependencies': [
'<(DEPTH)/base/base.gyp:base_java', '<(DEPTH)/base/base.gyp:base_java',
# TODO(kjellander): Figure out why base_build_config_gen is needed
# here. It really shouldn't since it's a dependency of base_java
# above, but there's always 0 tests run if it's missing.
'<(DEPTH)/base/base.gyp:base_build_config_gen',
'<(DEPTH)/build/android/pylib/device/commands/commands.gyp:chromium_commands', '<(DEPTH)/build/android/pylib/device/commands/commands.gyp:chromium_commands',
'<(DEPTH)/build/android/pylib/remote/device/dummy/dummy.gyp:remote_device_dummy_apk', '<(DEPTH)/build/android/pylib/remote/device/dummy/dummy.gyp:remote_device_dummy_apk',
'<(DEPTH)/testing/android/appurify_support.gyp:appurify_support_java', '<(DEPTH)/testing/android/appurify_support.gyp:appurify_support_java',
......
...@@ -34,7 +34,7 @@ import textwrap ...@@ -34,7 +34,7 @@ import textwrap
DIRECTORIES = [ DIRECTORIES = [
'build', 'build',
'buildtools', 'buildtools',
'google_apis', # Needed by build/common.gypi. 'mojo', # TODO(kjellander): Remove, see webrtc:5629.
'native_client', 'native_client',
'net', 'net',
'testing', 'testing',
...@@ -46,6 +46,7 @@ DIRECTORIES = [ ...@@ -46,6 +46,7 @@ DIRECTORIES = [
'third_party/llvm-build', 'third_party/llvm-build',
'third_party/lss', 'third_party/lss',
'third_party/yasm', 'third_party/yasm',
'third_party/WebKit', # TODO(kjellander): Remove, see webrtc:5629.
'tools/clang', 'tools/clang',
'tools/gn', 'tools/gn',
'tools/gyp', 'tools/gyp',
...@@ -63,15 +64,14 @@ if 'android' in target_os: ...@@ -63,15 +64,14 @@ if 'android' in target_os:
DIRECTORIES += [ DIRECTORIES += [
'base', 'base',
'third_party/android_platform', 'third_party/android_platform',
'third_party/android_testrunner',
'third_party/android_tools', 'third_party/android_tools',
'third_party/appurify-python', 'third_party/appurify-python',
'third_party/ashmem', 'third_party/ashmem',
'third_party/catapult', 'third_party/catapult',
'third_party/icu',
'third_party/ijar', 'third_party/ijar',
'third_party/jsr-305', 'third_party/jsr-305',
'third_party/junit', 'third_party/junit',
'third_party/libevent',
'third_party/libxml', 'third_party/libxml',
'third_party/mockito', 'third_party/mockito',
'third_party/modp_b64', 'third_party/modp_b64',
...@@ -80,14 +80,11 @@ if 'android' in target_os: ...@@ -80,14 +80,11 @@ if 'android' in target_os:
'third_party/robolectric', 'third_party/robolectric',
'tools/android', 'tools/android',
'tools/grit', 'tools/grit',
'tools/relocation_packer',
'tools/telemetry',
] ]
if 'ios' in target_os: if 'ios' in target_os:
DIRECTORIES.append('third_party/class-dump') DIRECTORIES.append('third_party/class-dump')
FILES = { FILES = {
'tools/find_depot_tools.py': None,
'tools/isolate_driver.py': None, 'tools/isolate_driver.py': None,
'third_party/BUILD.gn': None, 'third_party/BUILD.gn': None,
} }
......
...@@ -18,7 +18,7 @@ if (is_win) { ...@@ -18,7 +18,7 @@ if (is_win) {
config("gflags_config") { config("gflags_config") {
include_dirs = [ include_dirs = [
"$gflags_gen_arch_root/include", # For configured files. "$gflags_gen_arch_root/include", # For configured files.
"src", # For everything else. "src/src", # For everything else.
] ]
defines = [ defines = [
...@@ -38,31 +38,39 @@ config("gflags_config") { ...@@ -38,31 +38,39 @@ config("gflags_config") {
} }
source_set("gflags") { source_set("gflags") {
cflags = []
sources = [ sources = [
"src/gflags.cc", "src/src/gflags.cc",
"src/gflags_completions.cc", "src/src/gflags_completions.cc",
"src/gflags_reporting.cc", "src/src/gflags_reporting.cc",
] ]
if (is_win) { if (is_win) {
sources += [ "src/windows/port.cc" ] sources += [ "src/src/windows_port.cc" ]
cflags = [ cflags += [
"/wd4005", # WIN32_LEAN_AND_MEAN. "/wd4005", # WIN32_LEAN_AND_MEAN.
"/wd4267", # Conversion from size_t to "type". "/wd4267", # Conversion from size_t to "type".
] ]
} }
include_dirs = [ "$gflags_gen_arch_root/include/private" ] # For config.h include_dirs = [
"$gflags_gen_arch_root/include/gflags", # For configured files.
"$gflags_gen_arch_root/include/private", # For config.h
]
public_configs = [ ":gflags_config" ] public_configs = [ ":gflags_config" ]
configs -= [ "//build/config/compiler:chromium_code" ] configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ] configs += [ "//build/config/compiler:no_chromium_code" ]
if (is_win) {
configs -= [ "//build/config/win:unicode" ]
}
if (is_clang) { if (is_clang) {
# TODO(andrew): Look into fixing this warning upstream: # TODO(andrew): Look into fixing this warning upstream:
# http://code.google.com/p/webrtc/issues/detail?id=760 # http://code.google.com/p/webrtc/issues/detail?id=760
configs -= [ "//build/config/clang:extra_warnings" ] configs -= [ "//build/config/clang:extra_warnings" ]
cflags += [ "-Wno-microsoft-include" ]
} }
} }
URL: http://code.google.com/p/gflags/ URL: https://github.com/gflags/gflags
Version: 2.0 Version: 2.1.2
License: New BSD License: New BSD
License File: LICENSE License File: LICENSE
......
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// --- // ---
// Author: Ray Sidney
// Revamped and reorganized by Craig Silverstein // Revamped and reorganized by Craig Silverstein
// //
// This is the file that should be included by any file which declares // This is the file that should be included by any file which declares
...@@ -76,53 +75,27 @@ ...@@ -76,53 +75,27 @@
// other thread is writing to the variable or calling non-const // other thread is writing to the variable or calling non-const
// methods of this class. // methods of this class.
#ifndef GOOGLE_GFLAGS_H_ #ifndef GFLAGS_GFLAGS_H_
#define GOOGLE_GFLAGS_H_ #define GFLAGS_GFLAGS_H_
#include <string> #include <string>
#include <vector> #include <vector>
// We care a lot about number of bits things take up. Unfortunately, #include "gflags_declare.h" // IWYU pragma: export
// systems define their bit-specific ints in a lot of different ways.
// We use our own way, and have a typedef to get there.
// Note: these commands below may look like "#if 1" or "#if 0", but
// that's because they were constructed that way at ./configure time.
// Look at gflags.h.in to see how they're calculated (based on your config).
#if 1
#include <stdint.h> // the normal place uint16_t is defined
#endif
#if 1
#include <sys/types.h> // the normal place u_int16_t is defined
#endif
#if 1
#include <inttypes.h> // a third place for uint16_t or u_int16_t
#endif
namespace google {
// We always want to export variables defined in user code
#if 1 // the C99 format #ifndef GFLAGS_DLL_DEFINE_FLAG
typedef int32_t int32; # ifdef _MSC_VER
typedef uint32_t uint32; # define GFLAGS_DLL_DEFINE_FLAG __declspec(dllexport)
typedef int64_t int64; # else
typedef uint64_t uint64; # define GFLAGS_DLL_DEFINE_FLAG
#elif 1 // the BSD format # endif
typedef int32_t int32;
typedef u_int32_t uint32;
typedef int64_t int64;
typedef u_int64_t uint64;
#elif 0 // the windows (vc7) format
typedef __int32 int32;
typedef unsigned __int32 uint32;
typedef __int64 int64;
typedef unsigned __int64 uint64;
#else
#error Do not know how to define a 32-bit integer quantity on your system
#endif #endif
// TODO(kjellander): update generated .h's for new gflags.
// https://code.google.com/p/webrtc/issues/detail?id=2251 namespace GFLAGS_NAMESPACE {
extern const char* VersionString();
extern void SetVersionString(const std::string& version);
// -------------------------------------------------------------------- // --------------------------------------------------------------------
// To actually define a flag in a file, use DEFINE_bool, // To actually define a flag in a file, use DEFINE_bool,
...@@ -153,18 +126,17 @@ extern void SetVersionString(const std::string& version); ...@@ -153,18 +126,17 @@ extern void SetVersionString(const std::string& version);
// Returns true if successfully registered, false if not (because the // Returns true if successfully registered, false if not (because the
// first argument doesn't point to a command-line flag, or because a // first argument doesn't point to a command-line flag, or because a
// validator is already registered for this flag). // validator is already registered for this flag).
bool RegisterFlagValidator(const bool* flag, extern GFLAGS_DLL_DECL bool RegisterFlagValidator(const bool* flag, bool (*validate_fn)(const char*, bool));
bool (*validate_fn)(const char*, bool)); extern GFLAGS_DLL_DECL bool RegisterFlagValidator(const int32* flag, bool (*validate_fn)(const char*, int32));
bool RegisterFlagValidator(const int32* flag, extern GFLAGS_DLL_DECL bool RegisterFlagValidator(const int64* flag, bool (*validate_fn)(const char*, int64));
bool (*validate_fn)(const char*, int32)); extern GFLAGS_DLL_DECL bool RegisterFlagValidator(const uint64* flag, bool (*validate_fn)(const char*, uint64));
bool RegisterFlagValidator(const int64* flag, extern GFLAGS_DLL_DECL bool RegisterFlagValidator(const double* flag, bool (*validate_fn)(const char*, double));
bool (*validate_fn)(const char*, int64)); extern GFLAGS_DLL_DECL bool RegisterFlagValidator(const std::string* flag, bool (*validate_fn)(const char*, const std::string&));
bool RegisterFlagValidator(const uint64* flag,
bool (*validate_fn)(const char*, uint64)); // Convenience macro for the registration of a flag validator
bool RegisterFlagValidator(const double* flag, #define DEFINE_validator(name, validator) \
bool (*validate_fn)(const char*, double)); static const bool name##_validator_registered = \
bool RegisterFlagValidator(const std::string* flag, GFLAGS_NAMESPACE::RegisterFlagValidator(&FLAGS_##name, validator)
bool (*validate_fn)(const char*, const std::string&));
// -------------------------------------------------------------------- // --------------------------------------------------------------------
...@@ -177,7 +149,8 @@ bool RegisterFlagValidator(const std::string* flag, ...@@ -177,7 +149,8 @@ bool RegisterFlagValidator(const std::string* flag,
// In addition to accessing flags, you can also access argv[0] (the program // In addition to accessing flags, you can also access argv[0] (the program
// name) and argv (the entire commandline), which we sock away a copy of. // name) and argv (the entire commandline), which we sock away a copy of.
// These variables are static, so you should only set them once. // These variables are static, so you should only set them once.
//
// No need to export this data only structure from DLL, avoiding VS warning 4251.
struct CommandLineFlagInfo { struct CommandLineFlagInfo {
std::string name; // the name of the flag std::string name; // the name of the flag
std::string type; // the type of the flag: int32, etc std::string type; // the type of the flag: int32, etc
...@@ -185,41 +158,47 @@ struct CommandLineFlagInfo { ...@@ -185,41 +158,47 @@ struct CommandLineFlagInfo {
std::string current_value; // the current value, as a string std::string current_value; // the current value, as a string
std::string default_value; // the default value, as a string std::string default_value; // the default value, as a string
std::string filename; // 'cleaned' version of filename holding the flag std::string filename; // 'cleaned' version of filename holding the flag
bool has_validator_fn; // true if RegisterFlagValidator called on flag bool has_validator_fn; // true if RegisterFlagValidator called on this flag
bool is_default; // true if the flag has the default value and bool is_default; // true if the flag has the default value and
// has not been set explicitly from the cmdline // has not been set explicitly from the cmdline
// or via SetCommandLineOption // or via SetCommandLineOption
const void* flag_ptr; const void* flag_ptr; // pointer to the flag's current value (i.e. FLAGS_foo)
}; };
// Using this inside of a validator is a recipe for a deadlock. // Using this inside of a validator is a recipe for a deadlock.
// TODO(wojtekm) Fix locking when validators are running, to make it safe to // TODO(user) Fix locking when validators are running, to make it safe to
// call validators during ParseAllFlags. // call validators during ParseAllFlags.
// Also make sure then to uncomment the corresponding unit test in // Also make sure then to uncomment the corresponding unit test in
// commandlineflags_unittest.sh // gflags_unittest.sh
extern void GetAllFlags(std::vector<CommandLineFlagInfo>* OUTPUT); extern GFLAGS_DLL_DECL void GetAllFlags(std::vector<CommandLineFlagInfo>* OUTPUT);
// These two are actually defined in commandlineflags_reporting.cc. // These two are actually defined in gflags_reporting.cc.
extern void ShowUsageWithFlags(const char *argv0); // what --help does extern GFLAGS_DLL_DECL void ShowUsageWithFlags(const char *argv0); // what --help does
extern void ShowUsageWithFlagsRestrict(const char *argv0, const char *restrict); extern GFLAGS_DLL_DECL void ShowUsageWithFlagsRestrict(const char *argv0, const char *restrict);
// Create a descriptive string for a flag. // Create a descriptive string for a flag.
// Goes to some trouble to make pretty line breaks. // Goes to some trouble to make pretty line breaks.
extern std::string DescribeOneFlag(const CommandLineFlagInfo& flag); extern GFLAGS_DLL_DECL std::string DescribeOneFlag(const CommandLineFlagInfo& flag);
// Thread-hostile; meant to be called before any threads are spawned. // Thread-hostile; meant to be called before any threads are spawned.
extern void SetArgv(int argc, const char** argv); extern GFLAGS_DLL_DECL void SetArgv(int argc, const char** argv);
// The following functions are thread-safe as long as SetArgv() is // The following functions are thread-safe as long as SetArgv() is
// only called before any threads start. // only called before any threads start.
extern const std::vector<std::string>& GetArgvs(); // all of argv as a vector extern GFLAGS_DLL_DECL const std::vector<std::string>& GetArgvs();
extern const char* GetArgv(); // all of argv as a string extern GFLAGS_DLL_DECL const char* GetArgv(); // all of argv as a string
extern const char* GetArgv0(); // only argv0 extern GFLAGS_DLL_DECL const char* GetArgv0(); // only argv0
extern uint32 GetArgvSum(); // simple checksum of argv extern GFLAGS_DLL_DECL uint32 GetArgvSum(); // simple checksum of argv
extern const char* ProgramInvocationName(); // argv0, or "UNKNOWN" if not set extern GFLAGS_DLL_DECL const char* ProgramInvocationName(); // argv0, or "UNKNOWN" if not set
extern const char* ProgramInvocationShortName(); // basename(argv0) extern GFLAGS_DLL_DECL const char* ProgramInvocationShortName(); // basename(argv0)
// ProgramUsage() is thread-safe as long as SetUsageMessage() is only // ProgramUsage() is thread-safe as long as SetUsageMessage() is only
// called before any threads start. // called before any threads start.
extern const char* ProgramUsage(); // string set by SetUsageMessage() extern GFLAGS_DLL_DECL const char* ProgramUsage(); // string set by SetUsageMessage()
// VersionString() is thread-safe as long as SetVersionString() is only
// called before any threads start.
extern GFLAGS_DLL_DECL const char* VersionString(); // string set by SetVersionString()
// -------------------------------------------------------------------- // --------------------------------------------------------------------
...@@ -232,19 +211,18 @@ extern const char* ProgramUsage(); // string set by SetUsageMessage() ...@@ -232,19 +211,18 @@ extern const char* ProgramUsage(); // string set by SetUsageMessage()
// Return true iff the flagname was found. // Return true iff the flagname was found.
// OUTPUT is set to the flag's value, or unchanged if we return false. // OUTPUT is set to the flag's value, or unchanged if we return false.
extern bool GetCommandLineOption(const char* name, std::string* OUTPUT); extern GFLAGS_DLL_DECL bool GetCommandLineOption(const char* name, std::string* OUTPUT);
// Return true iff the flagname was found. OUTPUT is set to the flag's // Return true iff the flagname was found. OUTPUT is set to the flag's
// CommandLineFlagInfo or unchanged if we return false. // CommandLineFlagInfo or unchanged if we return false.
extern bool GetCommandLineFlagInfo(const char* name, extern GFLAGS_DLL_DECL bool GetCommandLineFlagInfo(const char* name, CommandLineFlagInfo* OUTPUT);
CommandLineFlagInfo* OUTPUT);
// Return the CommandLineFlagInfo of the flagname. exit() if name not found. // Return the CommandLineFlagInfo of the flagname. exit() if name not found.
// Example usage, to check if a flag's value is currently the default value: // Example usage, to check if a flag's value is currently the default value:
// if (GetCommandLineFlagInfoOrDie("foo").is_default) ... // if (GetCommandLineFlagInfoOrDie("foo").is_default) ...
extern CommandLineFlagInfo GetCommandLineFlagInfoOrDie(const char* name); extern GFLAGS_DLL_DECL CommandLineFlagInfo GetCommandLineFlagInfoOrDie(const char* name);
enum FlagSettingMode { enum GFLAGS_DLL_DECL FlagSettingMode {
// update the flag's value (can call this multiple times). // update the flag's value (can call this multiple times).
SET_FLAGS_VALUE, SET_FLAGS_VALUE,
// update the flag's value, but *only if* it has not yet been updated // update the flag's value, but *only if* it has not yet been updated
...@@ -264,9 +242,8 @@ enum FlagSettingMode { ...@@ -264,9 +242,8 @@ enum FlagSettingMode {
// non-empty else. // non-empty else.
// SetCommandLineOption uses set_mode == SET_FLAGS_VALUE (the common case) // SetCommandLineOption uses set_mode == SET_FLAGS_VALUE (the common case)
extern std::string SetCommandLineOption(const char* name, const char* value); extern GFLAGS_DLL_DECL std::string SetCommandLineOption (const char* name, const char* value);
extern std::string SetCommandLineOptionWithMode(const char* name, const char* value, extern GFLAGS_DLL_DECL std::string SetCommandLineOptionWithMode(const char* name, const char* value, FlagSettingMode set_mode);
FlagSettingMode set_mode);
// -------------------------------------------------------------------- // --------------------------------------------------------------------
...@@ -287,14 +264,17 @@ extern std::string SetCommandLineOptionWithMode(const char* name, const char* va ...@@ -287,14 +264,17 @@ extern std::string SetCommandLineOptionWithMode(const char* name, const char* va
// // without worrying about restoring the FLAG values. // // without worrying about restoring the FLAG values.
// } // }
// //
// Note: This class is marked with __attribute__((unused)) because all the // Note: This class is marked with GFLAGS_ATTRIBUTE_UNUSED because all
// work is done in the constructor and destructor, so in the standard // the work is done in the constructor and destructor, so in the standard
// usage example above, the compiler would complain that it's an // usage example above, the compiler would complain that it's an
// unused variable. // unused variable.
// //
// This class is thread-safe. // This class is thread-safe. However, its destructor writes to
// exactly the set of flags that have changed value during its
// lifetime, so concurrent _direct_ access to those flags
// (i.e. FLAGS_foo instead of {Get,Set}CommandLineOption()) is unsafe.
class FlagSaver { class GFLAGS_DLL_DECL FlagSaver {
public: public:
FlagSaver(); FlagSaver();
~FlagSaver(); ~FlagSaver();
...@@ -304,24 +284,23 @@ class FlagSaver { ...@@ -304,24 +284,23 @@ class FlagSaver {
FlagSaver(const FlagSaver&); // no copying! FlagSaver(const FlagSaver&); // no copying!
void operator=(const FlagSaver&); void operator=(const FlagSaver&);
} __attribute__ ((unused)); }__attribute((unused));
// -------------------------------------------------------------------- // --------------------------------------------------------------------
// Some deprecated or hopefully-soon-to-be-deprecated functions. // Some deprecated or hopefully-soon-to-be-deprecated functions.
// This is often used for logging. TODO(csilvers): figure out a better way // This is often used for logging. TODO(csilvers): figure out a better way
extern std::string CommandlineFlagsIntoString(); extern GFLAGS_DLL_DECL std::string CommandlineFlagsIntoString();
// Usually where this is used, a FlagSaver should be used instead. // Usually where this is used, a FlagSaver should be used instead.
extern bool ReadFlagsFromString(const std::string& flagfilecontents, extern GFLAGS_DLL_DECL
bool ReadFlagsFromString(const std::string& flagfilecontents,
const char* prog_name, const char* prog_name,
bool errors_are_fatal); // uses SET_FLAGS_VALUE bool errors_are_fatal); // uses SET_FLAGS_VALUE
// These let you manually implement --flagfile functionality. // These let you manually implement --flagfile functionality.
// DEPRECATED. // DEPRECATED.
extern bool AppendFlagsIntoFile(const std::string& filename, const char* prog_name); extern GFLAGS_DLL_DECL bool AppendFlagsIntoFile(const std::string& filename, const char* prog_name);
extern bool SaveCommandFlags(); // actually defined in google.cc ! extern GFLAGS_DLL_DECL bool ReadFromFlagsFile(const std::string& filename, const char* prog_name, bool errors_are_fatal); // uses SET_FLAGS_VALUE
extern bool ReadFromFlagsFile(const std::string& filename, const char* prog_name,
bool errors_are_fatal); // uses SET_FLAGS_VALUE
// -------------------------------------------------------------------- // --------------------------------------------------------------------
...@@ -332,16 +311,16 @@ extern bool ReadFromFlagsFile(const std::string& filename, const char* prog_name ...@@ -332,16 +311,16 @@ extern bool ReadFromFlagsFile(const std::string& filename, const char* prog_name
// Otherwise, return the value. NOTE: for booleans, for true use // Otherwise, return the value. NOTE: for booleans, for true use
// 't' or 'T' or 'true' or '1', for false 'f' or 'F' or 'false' or '0'. // 't' or 'T' or 'true' or '1', for false 'f' or 'F' or 'false' or '0'.
extern bool BoolFromEnv(const char *varname, bool defval); extern GFLAGS_DLL_DECL bool BoolFromEnv(const char *varname, bool defval);
extern int32 Int32FromEnv(const char *varname, int32 defval); extern GFLAGS_DLL_DECL int32 Int32FromEnv(const char *varname, int32 defval);
extern int64 Int64FromEnv(const char *varname, int64 defval); extern GFLAGS_DLL_DECL int64 Int64FromEnv(const char *varname, int64 defval);
extern uint64 Uint64FromEnv(const char *varname, uint64 defval); extern GFLAGS_DLL_DECL uint64 Uint64FromEnv(const char *varname, uint64 defval);
extern double DoubleFromEnv(const char *varname, double defval); extern GFLAGS_DLL_DECL double DoubleFromEnv(const char *varname, double defval);
extern const char *StringFromEnv(const char *varname, const char *defval); extern GFLAGS_DLL_DECL const char *StringFromEnv(const char *varname, const char *defval);
// -------------------------------------------------------------------- // --------------------------------------------------------------------
// The next two functions parse commandlineflags from main(): // The next two functions parse gflags from main():
// Set the "usage" message for this program. For example: // Set the "usage" message for this program. For example:
// string usage("This program does nothing. Sample usage:\n"); // string usage("This program does nothing. Sample usage:\n");
...@@ -349,7 +328,13 @@ extern const char *StringFromEnv(const char *varname, const char *defval); ...@@ -349,7 +328,13 @@ extern const char *StringFromEnv(const char *varname, const char *defval);
// SetUsageMessage(usage); // SetUsageMessage(usage);
// Do not include commandline flags in the usage: we do that for you! // Do not include commandline flags in the usage: we do that for you!
// Thread-hostile; meant to be called before any threads are spawned. // Thread-hostile; meant to be called before any threads are spawned.
extern void SetUsageMessage(const std::string& usage); extern GFLAGS_DLL_DECL void SetUsageMessage(const std::string& usage);
// Sets the version string, which is emitted with --version.
// For instance: SetVersionString("1.3");
// Thread-hostile; meant to be called before any threads are spawned.
extern GFLAGS_DLL_DECL void SetVersionString(const std::string& version);
// Looks for flags in argv and parses them. Rearranges argv to put // Looks for flags in argv and parses them. Rearranges argv to put
// flags first, or removes them entirely if remove_flags is true. // flags first, or removes them entirely if remove_flags is true.
...@@ -358,8 +343,7 @@ extern void SetUsageMessage(const std::string& usage); ...@@ -358,8 +343,7 @@ extern void SetUsageMessage(const std::string& usage);
// of the first non-flag argument. // of the first non-flag argument.
// See top-of-file for more details on this function. // See top-of-file for more details on this function.
#ifndef SWIG // In swig, use ParseCommandLineFlagsScript() instead. #ifndef SWIG // In swig, use ParseCommandLineFlagsScript() instead.
extern uint32 ParseCommandLineFlags(int *argc, char*** argv, extern GFLAGS_DLL_DECL uint32 ParseCommandLineFlags(int *argc, char*** argv, bool remove_flags);
bool remove_flags);
#endif #endif
...@@ -373,18 +357,18 @@ extern uint32 ParseCommandLineFlags(int *argc, char*** argv, ...@@ -373,18 +357,18 @@ extern uint32 ParseCommandLineFlags(int *argc, char*** argv,
// defined more than once in the command line or flag file, the last // defined more than once in the command line or flag file, the last
// definition is used. Returns the index (into argv) of the first // definition is used. Returns the index (into argv) of the first
// non-flag argument. (If remove_flags is true, will always return 1.) // non-flag argument. (If remove_flags is true, will always return 1.)
extern uint32 ParseCommandLineNonHelpFlags(int *argc, char*** argv, extern GFLAGS_DLL_DECL uint32 ParseCommandLineNonHelpFlags(int *argc, char*** argv, bool remove_flags);
bool remove_flags);
// This is actually defined in commandlineflags_reporting.cc. // This is actually defined in gflags_reporting.cc.
// This function is misnamed (it also handles --version, etc.), but // This function is misnamed (it also handles --version, etc.), but
// it's too late to change that now. :-( // it's too late to change that now. :-(
extern void HandleCommandLineHelpFlags(); // in commandlineflags_reporting.cc extern GFLAGS_DLL_DECL void HandleCommandLineHelpFlags(); // in gflags_reporting.cc
// Allow command line reparsing. Disables the error normally // Allow command line reparsing. Disables the error normally
// generated when an unknown flag is found, since it may be found in a // generated when an unknown flag is found, since it may be found in a
// later parse. Thread-hostile; meant to be called before any threads // later parse. Thread-hostile; meant to be called before any threads
// are spawned. // are spawned.
extern void AllowCommandLineReparsing(); extern GFLAGS_DLL_DECL void AllowCommandLineReparsing();
// Reparse the flags that have not yet been recognized. Only flags // Reparse the flags that have not yet been recognized. Only flags
// registered since the last parse will be recognized. Any flag value // registered since the last parse will be recognized. Any flag value
...@@ -392,19 +376,18 @@ extern void AllowCommandLineReparsing(); ...@@ -392,19 +376,18 @@ extern void AllowCommandLineReparsing();
// separate command line argument that follows the flag argument. // separate command line argument that follows the flag argument.
// Intended for handling flags from dynamically loaded libraries, // Intended for handling flags from dynamically loaded libraries,
// since their flags are not registered until they are loaded. // since their flags are not registered until they are loaded.
// Returns the index (into the original argv) of the first non-flag extern GFLAGS_DLL_DECL void ReparseCommandLineNonHelpFlags();
// argument. (If remove_flags is true, will always return 1.)
extern void ReparseCommandLineNonHelpFlags();
// Clean up memory allocated by flags. This is only needed to reduce // Clean up memory allocated by flags. This is only needed to reduce
// the quantity of "potentially leaked" reports emitted by memory // the quantity of "potentially leaked" reports emitted by memory
// debugging tools such as valgrind. It is not required for normal // debugging tools such as valgrind. It is not required for normal
// operation, or for the perftools heap-checker. It must only be called // operation, or for the google perftools heap-checker. It must only
// when the process is about to exit, and all threads that might // be called when the process is about to exit, and all threads that
// access flags are quiescent. Referencing flags after this is called // might access flags are quiescent. Referencing flags after this is
// will have unexpected consequences. This is not safe to run when // called will have unexpected consequences. This is not safe to run
// multiple threads might be running: the function is thread-hostile. // when multiple threads might be running: the function is
extern void ShutDownCommandLineFlags(); // thread-hostile.
extern GFLAGS_DLL_DECL void ShutDownCommandLineFlags();
// -------------------------------------------------------------------- // --------------------------------------------------------------------
...@@ -435,7 +418,7 @@ extern void ShutDownCommandLineFlags(); ...@@ -435,7 +418,7 @@ extern void ShutDownCommandLineFlags();
// directly. The idea is that DEFINE puts the flag in the weird // directly. The idea is that DEFINE puts the flag in the weird
// namespace, and DECLARE imports the flag from there into the current // namespace, and DECLARE imports the flag from there into the current
// namespace. The net result is to force people to use DECLARE to get // namespace. The net result is to force people to use DECLARE to get
// access to a flag, rather than saying "extern bool FLAGS_whatever;" // access to a flag, rather than saying "extern GFLAGS_DLL_DECL bool FLAGS_whatever;"
// or some such instead. We want this so we can put extra // or some such instead. We want this so we can put extra
// functionality (like sanity-checking) in DECLARE if we want, and // functionality (like sanity-checking) in DECLARE if we want, and
// make sure it is picked up everywhere. // make sure it is picked up everywhere.
...@@ -444,29 +427,30 @@ extern void ShutDownCommandLineFlags(); ...@@ -444,29 +427,30 @@ extern void ShutDownCommandLineFlags();
// people can't DECLARE_int32 something that they DEFINE_bool'd // people can't DECLARE_int32 something that they DEFINE_bool'd
// elsewhere. // elsewhere.
class FlagRegisterer { class GFLAGS_DLL_DECL FlagRegisterer {
public: public:
FlagRegisterer(const char* name, const char* type, FlagRegisterer(const char* name, const char* type,
const char* help, const char* filename, const char* help, const char* filename,
void* current_storage, void* defvalue_storage); void* current_storage, void* defvalue_storage);
}; };
extern bool FlagsTypeWarn(const char *name);
// If your application #defines STRIP_FLAG_HELP to a non-zero value // If your application #defines STRIP_FLAG_HELP to a non-zero value
// before #including this file, we remove the help message from the // before #including this file, we remove the help message from the
// binary file. This can reduce the size of the resulting binary // binary file. This can reduce the size of the resulting binary
// somewhat, and may also be useful for security reasons. // somewhat, and may also be useful for security reasons.
extern const char kStrippedFlagHelp[]; extern GFLAGS_DLL_DECL const char kStrippedFlagHelp[];
} // namespace GFLAGS_NAMESPACE
}
#ifndef SWIG // In swig, ignore the main flag declarations #ifndef SWIG // In swig, ignore the main flag declarations
#if defined(STRIP_FLAG_HELP) && STRIP_FLAG_HELP > 0 #if defined(STRIP_FLAG_HELP) && STRIP_FLAG_HELP > 0
// Need this construct to avoid the 'defined but not used' warning. // Need this construct to avoid the 'defined but not used' warning.
#define MAYBE_STRIPPED_HELP(txt) (false ? (txt) : ::google::kStrippedFlagHelp) #define MAYBE_STRIPPED_HELP(txt) \
(false ? (txt) : GFLAGS_NAMESPACE::kStrippedFlagHelp)
#else #else
#define MAYBE_STRIPPED_HELP(txt) txt #define MAYBE_STRIPPED_HELP(txt) txt
#endif #endif
...@@ -485,20 +469,15 @@ extern const char kStrippedFlagHelp[]; ...@@ -485,20 +469,15 @@ extern const char kStrippedFlagHelp[];
#define DEFINE_VARIABLE(type, shorttype, name, value, help) \ #define DEFINE_VARIABLE(type, shorttype, name, value, help) \
namespace fL##shorttype { \ namespace fL##shorttype { \
static const type FLAGS_nono##name = value; \ static const type FLAGS_nono##name = value; \
type FLAGS_##name = FLAGS_nono##name; \ /* We always want to export defined variables, dll or no */ \
GFLAGS_DLL_DEFINE_FLAG type FLAGS_##name = FLAGS_nono##name; \
type FLAGS_no##name = FLAGS_nono##name; \ type FLAGS_no##name = FLAGS_nono##name; \
static ::google::FlagRegisterer o_##name( \ static GFLAGS_NAMESPACE::FlagRegisterer o_##name( \
#name, #type, MAYBE_STRIPPED_HELP(help), __FILE__, \ #name, #type, MAYBE_STRIPPED_HELP(help), __FILE__, \
&FLAGS_##name, &FLAGS_no##name); \ &FLAGS_##name, &FLAGS_no##name); \
} \ } \
using fL##shorttype::FLAGS_##name using fL##shorttype::FLAGS_##name
#define DECLARE_VARIABLE(type, shorttype, name) \
namespace fL##shorttype { \
extern type FLAGS_##name; \
} \
using fL##shorttype::FLAGS_##name
// For DEFINE_bool, we want to do the extra check that the passed-in // For DEFINE_bool, we want to do the extra check that the passed-in
// value is actually a bool, and not a string or something that can be // value is actually a bool, and not a string or something that can be
// coerced to a bool. These declarations (no definition needed!) will // coerced to a bool. These declarations (no definition needed!) will
...@@ -506,34 +485,39 @@ extern const char kStrippedFlagHelp[]; ...@@ -506,34 +485,39 @@ extern const char kStrippedFlagHelp[];
// We'll use 'sizeof(IsBool(val))' to distinguish. This code requires // We'll use 'sizeof(IsBool(val))' to distinguish. This code requires
// that the compiler have different sizes for bool & double. Since // that the compiler have different sizes for bool & double. Since
// this is not guaranteed by the standard, we check it with a // this is not guaranteed by the standard, we check it with a
// compile-time assert (msg[-1] will give a compile-time error). // COMPILE_ASSERT.
namespace fLB { namespace fLB {
struct CompileAssert {}; struct CompileAssert {};
typedef CompileAssert expected_sizeof_double_neq_sizeof_bool[ typedef CompileAssert expected_sizeof_double_neq_sizeof_bool[
(sizeof(double) != sizeof(bool)) ? 1 : -1]; (sizeof(double) != sizeof(bool)) ? 1 : -1];
template<typename From> double IsBoolFlag(const From& from); template<typename From> double GFLAGS_DLL_DECL IsBoolFlag(const From& from);
bool IsBoolFlag(bool from); GFLAGS_DLL_DECL bool IsBoolFlag(bool from);
} // namespace fLB } // namespace fLB
#define DECLARE_bool(name) DECLARE_VARIABLE(bool, B, name) // Here are the actual DEFINE_*-macros. The respective DECLARE_*-macros
// are in a separate include, gflags_declare.h, for reducing
// the physical transitive size for DECLARE use.
#define DEFINE_bool(name, val, txt) \ #define DEFINE_bool(name, val, txt) \
namespace fLB { \ namespace fLB { \
typedef ::fLB::CompileAssert FLAG_##name##_value_is_not_a_bool[ \ typedef ::fLB::CompileAssert FLAG_##name##_value_is_not_a_bool[ \
(sizeof(::fLB::IsBoolFlag(val)) != sizeof(double)) ? 1 : -1]; \ (sizeof(::fLB::IsBoolFlag(val)) != sizeof(double))? 1: -1]; \
} \ } \
DEFINE_VARIABLE(bool, B, name, val, txt) DEFINE_VARIABLE(bool, B, name, val, txt)
#define DECLARE_int32(name) DECLARE_VARIABLE(::google::int32, I, name) #define DEFINE_int32(name, val, txt) \
#define DEFINE_int32(name,val,txt) DEFINE_VARIABLE(::google::int32, I, name, val, txt) DEFINE_VARIABLE(GFLAGS_NAMESPACE::int32, I, \
name, val, txt)
#define DECLARE_int64(name) DECLARE_VARIABLE(::google::int64, I64, name) #define DEFINE_int64(name, val, txt) \
#define DEFINE_int64(name,val,txt) DEFINE_VARIABLE(::google::int64, I64, name, val, txt) DEFINE_VARIABLE(GFLAGS_NAMESPACE::int64, I64, \
name, val, txt)
#define DECLARE_uint64(name) DECLARE_VARIABLE(::google::uint64, U64, name) #define DEFINE_uint64(name,val, txt) \
#define DEFINE_uint64(name,val,txt) DEFINE_VARIABLE(::google::uint64, U64, name, val, txt) DEFINE_VARIABLE(GFLAGS_NAMESPACE::uint64, U64, \
name, val, txt)
#define DECLARE_double(name) DECLARE_VARIABLE(double, D, name) #define DEFINE_double(name, val, txt) \
#define DEFINE_double(name, val, txt) DEFINE_VARIABLE(double, D, name, val, txt) DEFINE_VARIABLE(double, D, name, val, txt)
// Strings are trickier, because they're not a POD, so we can't // Strings are trickier, because they're not a POD, so we can't
// construct them at static-initialization time (instead they get // construct them at static-initialization time (instead they get
...@@ -543,11 +527,6 @@ bool IsBoolFlag(bool from); ...@@ -543,11 +527,6 @@ bool IsBoolFlag(bool from);
// into it later. It's not perfect, but the best we can do. // into it later. It's not perfect, but the best we can do.
namespace fLS { namespace fLS {
// The meaning of "string" might be different between now and when the
// macros below get invoked (e.g., if someone is experimenting with
// other string implementations that get defined after this file is
// included). Save the current meaning now and use it in the macros.
typedef std::string clstring;
inline clstring* dont_pass0toDEFINE_string(char *stringspot, inline clstring* dont_pass0toDEFINE_string(char *stringspot,
const char *value) { const char *value) {
...@@ -561,9 +540,6 @@ inline clstring* dont_pass0toDEFINE_string(char *stringspot, ...@@ -561,9 +540,6 @@ inline clstring* dont_pass0toDEFINE_string(char *stringspot,
int value); int value);
} // namespace fLS } // namespace fLS
#define DECLARE_string(name) namespace fLS { extern ::fLS::clstring& FLAGS_##name; } \
using fLS::FLAGS_##name
// We need to define a var named FLAGS_no##name so people don't define // We need to define a var named FLAGS_no##name so people don't define
// --string and --nostring. And we need a temporary place to put val // --string and --nostring. And we need a temporary place to put val
// so we don't have to evaluate it twice. Two great needs that go // so we don't have to evaluate it twice. Two great needs that go
...@@ -578,10 +554,10 @@ inline clstring* dont_pass0toDEFINE_string(char *stringspot, ...@@ -578,10 +554,10 @@ inline clstring* dont_pass0toDEFINE_string(char *stringspot,
clstring* const FLAGS_no##name = ::fLS:: \ clstring* const FLAGS_no##name = ::fLS:: \
dont_pass0toDEFINE_string(s_##name[0].s, \ dont_pass0toDEFINE_string(s_##name[0].s, \
val); \ val); \
static ::google::FlagRegisterer o_##name( \ static GFLAGS_NAMESPACE::FlagRegisterer o_##name( \
#name, "string", MAYBE_STRIPPED_HELP(txt), __FILE__, \ #name, "string", MAYBE_STRIPPED_HELP(txt), __FILE__, \
s_##name[0].s, new (s_##name[1].s) clstring(*FLAGS_no##name)); \ s_##name[0].s, new (s_##name[1].s) clstring(*FLAGS_no##name)); \
extern clstring& FLAGS_##name; \ extern GFLAGS_DLL_DEFINE_FLAG clstring& FLAGS_##name; \
using fLS::FLAGS_##name; \ using fLS::FLAGS_##name; \
clstring& FLAGS_##name = *FLAGS_no##name; \ clstring& FLAGS_##name = *FLAGS_no##name; \
} \ } \
...@@ -589,4 +565,9 @@ inline clstring* dont_pass0toDEFINE_string(char *stringspot, ...@@ -589,4 +565,9 @@ inline clstring* dont_pass0toDEFINE_string(char *stringspot,
#endif // SWIG #endif // SWIG
#endif // GOOGLE_GFLAGS_H_
// Import gflags library symbols into alternative/deprecated namespace(s)
#include "gflags_gflags.h"
#endif // GFLAGS_GFLAGS_H_
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// //
// --- // ---
// Author: Dave Nicponski
// //
// Implement helpful bash-style command line flag completions // Implement helpful bash-style command line flag completions
// //
...@@ -89,7 +89,7 @@ ...@@ -89,7 +89,7 @@
/* /*
$ complete -o bashdefault -o default -o nospace -C \ $ complete -o bashdefault -o default -o nospace -C \
'/usr/local/bin/gflags_completions.sh --tab_completion_columns $COLUMNS' \ '/home/build/eng/bash/bash_completions.sh --tab_completion_columns $COLUMNS' \
time env binary_name another_binary [...] time env binary_name another_binary [...]
*/ */
...@@ -109,13 +109,13 @@ $ complete -o bashdefault -o default -o nospace -C \ ...@@ -109,13 +109,13 @@ $ complete -o bashdefault -o default -o nospace -C \
// produce the expected completion output. // produce the expected completion output.
#ifndef GOOGLE_GFLAGS_COMPLETIONS_H_ #ifndef GFLAGS_COMPLETIONS_H_
#define GOOGLE_GFLAGS_COMPLETIONS_H_ #define GFLAGS_COMPLETIONS_H_
namespace google { namespace google {
void HandleCommandLineCompletions(void); extern void HandleCommandLineCompletions(void);
} }
#endif // GOOGLE_GFLAGS_COMPLETIONS_H_ #endif // GFLAGS_COMPLETIONS_H_
// Copyright (c) 1999, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// ---
//
// Revamped and reorganized by Craig Silverstein
//
// This is the file that should be included by any file which declares
// command line flag.
#ifndef GFLAGS_DECLARE_H_
#define GFLAGS_DECLARE_H_
// ---------------------------------------------------------------------------
// Namespace of gflags library symbols.
#define GFLAGS_NAMESPACE google
// ---------------------------------------------------------------------------
// Windows DLL import/export.
// We always want to import the symbols of the gflags library
#ifndef GFLAGS_DLL_DECL
# if 0 && defined(_MSC_VER)
# define GFLAGS_DLL_DECL __declspec(dllimport)
# else
# define GFLAGS_DLL_DECL
# endif
#endif
// We always want to import variables declared in user code
#ifndef GFLAGS_DLL_DECLARE_FLAG
# ifdef _MSC_VER
# define GFLAGS_DLL_DECLARE_FLAG __declspec(dllimport)
# else
# define GFLAGS_DLL_DECLARE_FLAG
# endif
#endif
// ---------------------------------------------------------------------------
// Flag types
#include <string>
#if 1
# include <stdint.h> // the normal place uint32_t is defined
#elif 1
# include <sys/types.h> // the normal place u_int32_t is defined
#elif 1
# include <inttypes.h> // a third place for uint32_t or u_int32_t
#endif
namespace GFLAGS_NAMESPACE {
#if 1 // C99
typedef int32_t int32;
typedef uint32_t uint32;
typedef int64_t int64;
typedef uint64_t uint64;
#elif 0 // BSD
typedef int32_t int32;
typedef u_int32_t uint32;
typedef int64_t int64;
typedef u_int64_t uint64;
#elif 0 // Windows
typedef __int32 int32;
typedef unsigned __int32 uint32;
typedef __int64 int64;
typedef unsigned __int64 uint64;
#else
# error Do not know how to define a 32-bit integer quantity on your system
#endif
} // namespace GFLAGS_NAMESPACE
namespace fLS {
// The meaning of "string" might be different between now and when the
// macros below get invoked (e.g., if someone is experimenting with
// other string implementations that get defined after this file is
// included). Save the current meaning now and use it in the macros.
typedef std::string clstring;
} // namespace fLS
#define DECLARE_VARIABLE(type, shorttype, name) \
/* We always want to import declared variables, dll or no */ \
namespace fL##shorttype { extern GFLAGS_DLL_DECLARE_FLAG type FLAGS_##name; } \
using fL##shorttype::FLAGS_##name
#define DECLARE_bool(name) \
DECLARE_VARIABLE(bool, B, name)
#define DECLARE_int32(name) \
DECLARE_VARIABLE(::GFLAGS_NAMESPACE::int32, I, name)
#define DECLARE_int64(name) \
DECLARE_VARIABLE(::GFLAGS_NAMESPACE::int64, I64, name)
#define DECLARE_uint64(name) \
DECLARE_VARIABLE(::GFLAGS_NAMESPACE::uint64, U64, name)
#define DECLARE_double(name) \
DECLARE_VARIABLE(double, D, name)
#define DECLARE_string(name) \
/* We always want to import declared variables, dll or no */ \
namespace fLS { \
using ::fLS::clstring; \
extern GFLAGS_DLL_DECLARE_FLAG ::fLS::clstring& FLAGS_##name; \
} \
using fLS::FLAGS_##name
#endif // GFLAGS_DECLARE_H_
// Copyright (c) 2014, Andreas Schuh
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// -----------------------------------------------------------------------------
// Imports the gflags library symbols into an alternative/deprecated namespace.
#ifndef GFLAGS_GFLAGS_H_
# error The internal header gflags_gflags.h may only be included by gflags.h
#endif
#ifndef GFLAGS_NS_GFLAGS_H_
#define GFLAGS_NS_GFLAGS_H_
namespace gflags {
using GFLAGS_NAMESPACE::int32;
using GFLAGS_NAMESPACE::uint32;
using GFLAGS_NAMESPACE::int64;
using GFLAGS_NAMESPACE::uint64;
using GFLAGS_NAMESPACE::RegisterFlagValidator;
using GFLAGS_NAMESPACE::CommandLineFlagInfo;
using GFLAGS_NAMESPACE::GetAllFlags;
using GFLAGS_NAMESPACE::ShowUsageWithFlags;
using GFLAGS_NAMESPACE::ShowUsageWithFlagsRestrict;
using GFLAGS_NAMESPACE::DescribeOneFlag;
using GFLAGS_NAMESPACE::SetArgv;
using GFLAGS_NAMESPACE::GetArgvs;
using GFLAGS_NAMESPACE::GetArgv;
using GFLAGS_NAMESPACE::GetArgv0;
using GFLAGS_NAMESPACE::GetArgvSum;
using GFLAGS_NAMESPACE::ProgramInvocationName;
using GFLAGS_NAMESPACE::ProgramInvocationShortName;
using GFLAGS_NAMESPACE::ProgramUsage;
using GFLAGS_NAMESPACE::VersionString;
using GFLAGS_NAMESPACE::GetCommandLineOption;
using GFLAGS_NAMESPACE::GetCommandLineFlagInfo;
using GFLAGS_NAMESPACE::GetCommandLineFlagInfoOrDie;
using GFLAGS_NAMESPACE::FlagSettingMode;
using GFLAGS_NAMESPACE::SET_FLAGS_VALUE;
using GFLAGS_NAMESPACE::SET_FLAG_IF_DEFAULT;
using GFLAGS_NAMESPACE::SET_FLAGS_DEFAULT;
using GFLAGS_NAMESPACE::SetCommandLineOption;
using GFLAGS_NAMESPACE::SetCommandLineOptionWithMode;
using GFLAGS_NAMESPACE::FlagSaver;
using GFLAGS_NAMESPACE::CommandlineFlagsIntoString;
using GFLAGS_NAMESPACE::ReadFlagsFromString;
using GFLAGS_NAMESPACE::AppendFlagsIntoFile;
using GFLAGS_NAMESPACE::ReadFromFlagsFile;
using GFLAGS_NAMESPACE::BoolFromEnv;
using GFLAGS_NAMESPACE::Int32FromEnv;
using GFLAGS_NAMESPACE::Int64FromEnv;
using GFLAGS_NAMESPACE::Uint64FromEnv;
using GFLAGS_NAMESPACE::DoubleFromEnv;
using GFLAGS_NAMESPACE::StringFromEnv;
using GFLAGS_NAMESPACE::SetUsageMessage;
using GFLAGS_NAMESPACE::SetVersionString;
using GFLAGS_NAMESPACE::ParseCommandLineNonHelpFlags;
using GFLAGS_NAMESPACE::HandleCommandLineHelpFlags;
using GFLAGS_NAMESPACE::AllowCommandLineReparsing;
using GFLAGS_NAMESPACE::ReparseCommandLineNonHelpFlags;
using GFLAGS_NAMESPACE::ShutDownCommandLineFlags;
using GFLAGS_NAMESPACE::FlagRegisterer;
#ifndef SWIG
using GFLAGS_NAMESPACE::ParseCommandLineFlags;
#endif
} // namespace gflags
#endif // GFLAGS_NS_GFLAGS_H_
/* src/config.h. Generated from config.h.in by configure. */ /* Generated from config.h.in during build configuration using CMake. */
/* src/config.h.in. Generated from configure.ac by autoheader. */
/* Always the empty-string on non-windows systems. On windows, should be // Note: This header file is only used internally. It is not part of public interface!
"__declspec(dllexport)". This way, when we compile the dll, we export our
functions/classes. It's safe to define this here because config.h is only
used internally, to compile the DLL, and every DLL source file #includes
"config.h" before anything else. */
#define GFLAGS_DLL_DECL /**/
/* Namespace for Google classes */ // ---------------------------------------------------------------------------
#define GOOGLE_NAMESPACE ::google // System checks
/* Define to 1 if you have the <dlfcn.h> header file. */ // Define if you build this library for a MS Windows OS.
#define HAVE_DLFCN_H 1 /* #undef OS_WINDOWS */
/* Define to 1 if you have the <fnmatch.h> header file. */ // Define if you have the <stdint.h> header file.
#define HAVE_FNMATCH_H 1 #define HAVE_STDINT_H
/* Define to 1 if you have the <inttypes.h> header file. */ // Define if you have the <sys/types.h> header file.
#define HAVE_INTTYPES_H 1 #define HAVE_SYS_TYPES_H
/* Define to 1 if you have the <memory.h> header file. */ // Define if you have the <inttypes.h> header file.
#define HAVE_MEMORY_H 1 #define HAVE_INTTYPES_H
/* define if the compiler implements namespaces */ // Define if you have the <sys/stat.h> header file.
#define HAVE_NAMESPACES 1 #define HAVE_SYS_STAT_H
/* Define if you have POSIX threads libraries and header files. */ // Define if you have the <unistd.h> header file.
#define HAVE_PTHREAD 1 #define HAVE_UNISTD_H
/* Define to 1 if you have the `putenv' function. */ // Define if you have the <fnmatch.h> header file.
#define HAVE_PUTENV 1 #define HAVE_FNMATCH_H
/* Define to 1 if you have the `setenv' function. */ // Define if you have the <shlwapi.h> header file (Windows 2000/XP).
#define HAVE_SETENV 1 /* #undef HAVE_SHLWAPI_H */
/* Define to 1 if you have the <stdint.h> header file. */ // Define if you have the strtoll function.
#define HAVE_STDINT_H 1 #define HAVE_STRTOLL
/* Define to 1 if you have the <stdlib.h> header file. */ // Define if you have the strtoq function.
#define HAVE_STDLIB_H 1 /* #undef HAVE_STRTOQ */
/* Define to 1 if you have the <strings.h> header file. */ // Define if you have the <pthread.h> header file.
#define HAVE_STRINGS_H 1 #define HAVE_PTHREAD
/* Define to 1 if you have the <string.h> header file. */ // Define if your pthread library defines the type pthread_rwlock_t
#define HAVE_STRING_H 1 #define HAVE_RWLOCK
/* Define to 1 if you have the `strtoll' function. */ // gcc requires this to get PRId64, etc.
#define HAVE_STRTOLL 1 #if defined(HAVE_INTTYPES_H) && !defined(__STDC_FORMAT_MACROS)
# define __STDC_FORMAT_MACROS 1
#endif
/* Define to 1 if you have the `strtoq' function. */ // ---------------------------------------------------------------------------
#define HAVE_STRTOQ 1 // Package information
/* Define to 1 if you have the <sys/stat.h> header file. */ // Name of package.
#define HAVE_SYS_STAT_H 1 #define PACKAGE gflags
/* Define to 1 if you have the <sys/types.h> header file. */ // Define to the full name of this package.
#define HAVE_SYS_TYPES_H 1 #define PACKAGE_NAME gflags
/* Define to 1 if you have the <unistd.h> header file. */ // Define to the full name and version of this package.
#define HAVE_UNISTD_H 1 #define PACKAGE_STRING gflags 2.2.0
/* define if your compiler has __attribute__ */ // Define to the one symbol short name of this package.
#define HAVE___ATTRIBUTE__ 1 #define PACKAGE_TARNAME gflags-2.2.0
/* Define to the sub-directory in which libtool stores uninstalled libraries. // Define to the version of this package.
*/ #define PACKAGE_VERSION 2.2.0
#define LT_OBJDIR ".libs/"
/* Name of package */ // Version number of package.
#define PACKAGE "gflags" #define VERSION PACKAGE_VERSION
/* Define to the address where bug reports for this package should be sent. */ // Define to the address where bug reports for this package should be sent.
#define PACKAGE_BUGREPORT "opensource@google.com" #define PACKAGE_BUGREPORT https://github.com/schuhschuh/gflags/issues
/* Define to the full name of this package. */ // ---------------------------------------------------------------------------
#define PACKAGE_NAME "gflags" // Path separator
#ifndef PATH_SEPARATOR
# ifdef OS_WINDOWS
# define PATH_SEPARATOR '\\'
# else
# define PATH_SEPARATOR '/'
# endif
#endif
/* Define to the full name and version of this package. */ // ---------------------------------------------------------------------------
#define PACKAGE_STRING "gflags 1.5" // Windows
/* Define to the one symbol short name of this package. */ // Whether gflags library is a DLL.
#define PACKAGE_TARNAME "gflags" #ifndef GFLAGS_IS_A_DLL
# define GFLAGS_IS_A_DLL 0
#endif
/* Define to the home page for this package. */ // Always export symbols when compiling a shared library as this file is only
#define PACKAGE_URL "" // included by internal modules when building the gflags library itself.
// The gflags_declare.h header file will set it to import these symbols otherwise.
/* Define to the version of this package. */ #ifndef GFLAGS_DLL_DECL
#define PACKAGE_VERSION "1.5" # if GFLAGS_IS_A_DLL && defined(_MSC_VER)
# define GFLAGS_DLL_DECL __declspec(dllexport)
/* Define to necessary symbol if this constant uses a non-standard name on # else
your system. */ # define GFLAGS_DLL_DECL
/* #undef PTHREAD_CREATE_JOINABLE */ # endif
#endif
/* Define to 1 if you have the ANSI C header files. */ // Flags defined by the gflags library itself must be exported
#define STDC_HEADERS 1 #ifndef GFLAGS_DLL_DEFINE_FLAG
# define GFLAGS_DLL_DEFINE_FLAG GFLAGS_DLL_DECL
/* the namespace where STL code like vector<> is defined */ #endif
#define STL_NAMESPACE std
#ifdef OS_WINDOWS
/* Version number of package */ // The unittests import the symbols of the shared gflags library
#define VERSION "1.5" # if GFLAGS_IS_A_DLL && defined(_MSC_VER)
# define GFLAGS_DLL_DECL_FOR_UNITTESTS __declspec(dllimport)
/* Stops putting the code inside the Google namespace */ # endif
#define _END_GOOGLE_NAMESPACE_ } # include "windows_port.h"
#endif
/* Puts following code inside the Google namespace */
#define _START_GOOGLE_NAMESPACE_ namespace google {
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// --- // ---
// Author: Ray Sidney
// Revamped and reorganized by Craig Silverstein // Revamped and reorganized by Craig Silverstein
// //
// This is the file that should be included by any file which declares // This is the file that should be included by any file which declares
...@@ -76,76 +75,27 @@ ...@@ -76,76 +75,27 @@
// other thread is writing to the variable or calling non-const // other thread is writing to the variable or calling non-const
// methods of this class. // methods of this class.
#ifndef GOOGLE_GFLAGS_H_ #ifndef GFLAGS_GFLAGS_H_
#define GOOGLE_GFLAGS_H_ #define GFLAGS_GFLAGS_H_
#include <string> #include <string>
#include <vector> #include <vector>
// We care a lot about number of bits things take up. Unfortunately, #include "gflags_declare.h" // IWYU pragma: export
// systems define their bit-specific ints in a lot of different ways.
// We use our own way, and have a typedef to get there.
// Note: these commands below may look like "#if 1" or "#if 0", but
// that's because they were constructed that way at ./configure time.
// Look at gflags.h.in to see how they're calculated (based on your config).
#if 0
#include <stdint.h> // the normal place uint16_t is defined
#endif
#if 1
#include <sys/types.h> // the normal place u_int16_t is defined
#endif
#if 0
#include <inttypes.h> // a third place for uint16_t or u_int16_t
#endif
// Annoying stuff for windows -- makes sure clients can import these functions
#if defined(_WIN32) // We always want to export variables defined in user code
# ifndef GFLAGS_DLL_DECL #ifndef GFLAGS_DLL_DEFINE_FLAG
# define GFLAGS_DLL_DECL __declspec(dllimport) # ifdef _MSC_VER
# endif
# ifndef GFLAGS_DLL_DECLARE_FLAG
# define GFLAGS_DLL_DECLARE_FLAG __declspec(dllimport)
# endif
# ifndef GFLAGS_DLL_DEFINE_FLAG
# define GFLAGS_DLL_DEFINE_FLAG __declspec(dllexport) # define GFLAGS_DLL_DEFINE_FLAG __declspec(dllexport)
# endif # else
#else
# ifndef GFLAGS_DLL_DECL
# define GFLAGS_DLL_DECL
# endif
# ifndef GFLAGS_DLL_DECLARE_FLAG
# define GFLAGS_DLL_DECLARE_FLAG
# endif
# ifndef GFLAGS_DLL_DEFINE_FLAG
# define GFLAGS_DLL_DEFINE_FLAG # define GFLAGS_DLL_DEFINE_FLAG
# endif # endif
#endif #endif
namespace google {
#if 0 // the C99 format
typedef int32_t int32;
typedef uint32_t uint32;
typedef int64_t int64;
typedef uint64_t uint64;
#elif 0 // the BSD format
typedef int32_t int32;
typedef u_int32_t uint32;
typedef int64_t int64;
typedef u_int64_t uint64;
#elif 1 // the windows (vc7) format
typedef __int32 int32;
typedef unsigned __int32 uint32;
typedef __int64 int64;
typedef unsigned __int64 uint64;
#else
#error Do not know how to define a 32-bit integer quantity on your system
#endif
// TODO(kjellander): update generated .h's for new gflags. namespace GFLAGS_NAMESPACE {
// https://code.google.com/p/webrtc/issues/detail?id=2251
extern const char* VersionString();
extern void SetVersionString(const std::string& version);
// -------------------------------------------------------------------- // --------------------------------------------------------------------
// To actually define a flag in a file, use DEFINE_bool, // To actually define a flag in a file, use DEFINE_bool,
...@@ -176,18 +126,17 @@ extern void SetVersionString(const std::string& version); ...@@ -176,18 +126,17 @@ extern void SetVersionString(const std::string& version);
// Returns true if successfully registered, false if not (because the // Returns true if successfully registered, false if not (because the
// first argument doesn't point to a command-line flag, or because a // first argument doesn't point to a command-line flag, or because a
// validator is already registered for this flag). // validator is already registered for this flag).
GFLAGS_DLL_DECL bool RegisterFlagValidator(const bool* flag, extern GFLAGS_DLL_DECL bool RegisterFlagValidator(const bool* flag, bool (*validate_fn)(const char*, bool));
bool (*validate_fn)(const char*, bool)); extern GFLAGS_DLL_DECL bool RegisterFlagValidator(const int32* flag, bool (*validate_fn)(const char*, int32));
GFLAGS_DLL_DECL bool RegisterFlagValidator(const int32* flag, extern GFLAGS_DLL_DECL bool RegisterFlagValidator(const int64* flag, bool (*validate_fn)(const char*, int64));
bool (*validate_fn)(const char*, int32)); extern GFLAGS_DLL_DECL bool RegisterFlagValidator(const uint64* flag, bool (*validate_fn)(const char*, uint64));
GFLAGS_DLL_DECL bool RegisterFlagValidator(const int64* flag, extern GFLAGS_DLL_DECL bool RegisterFlagValidator(const double* flag, bool (*validate_fn)(const char*, double));
bool (*validate_fn)(const char*, int64)); extern GFLAGS_DLL_DECL bool RegisterFlagValidator(const std::string* flag, bool (*validate_fn)(const char*, const std::string&));
GFLAGS_DLL_DECL bool RegisterFlagValidator(const uint64* flag,
bool (*validate_fn)(const char*, uint64)); // Convenience macro for the registration of a flag validator
GFLAGS_DLL_DECL bool RegisterFlagValidator(const double* flag, #define DEFINE_validator(name, validator) \
bool (*validate_fn)(const char*, double)); static const bool name##_validator_registered = \
GFLAGS_DLL_DECL bool RegisterFlagValidator(const std::string* flag, GFLAGS_NAMESPACE::RegisterFlagValidator(&FLAGS_##name, validator)
bool (*validate_fn)(const char*, const std::string&));
// -------------------------------------------------------------------- // --------------------------------------------------------------------
...@@ -200,28 +149,29 @@ GFLAGS_DLL_DECL bool RegisterFlagValidator(const std::string* flag, ...@@ -200,28 +149,29 @@ GFLAGS_DLL_DECL bool RegisterFlagValidator(const std::string* flag,
// In addition to accessing flags, you can also access argv[0] (the program // In addition to accessing flags, you can also access argv[0] (the program
// name) and argv (the entire commandline), which we sock away a copy of. // name) and argv (the entire commandline), which we sock away a copy of.
// These variables are static, so you should only set them once. // These variables are static, so you should only set them once.
//
struct GFLAGS_DLL_DECL CommandLineFlagInfo { // No need to export this data only structure from DLL, avoiding VS warning 4251.
struct CommandLineFlagInfo {
std::string name; // the name of the flag std::string name; // the name of the flag
std::string type; // the type of the flag: int32, etc std::string type; // the type of the flag: int32, etc
std::string description; // the "help text" associated with the flag std::string description; // the "help text" associated with the flag
std::string current_value; // the current value, as a string std::string current_value; // the current value, as a string
std::string default_value; // the default value, as a string std::string default_value; // the default value, as a string
std::string filename; // 'cleaned' version of filename holding the flag std::string filename; // 'cleaned' version of filename holding the flag
bool has_validator_fn; // true if RegisterFlagValidator called on flag bool has_validator_fn; // true if RegisterFlagValidator called on this flag
bool is_default; // true if the flag has the default value and bool is_default; // true if the flag has the default value and
// has not been set explicitly from the cmdline // has not been set explicitly from the cmdline
// or via SetCommandLineOption // or via SetCommandLineOption
const void* flag_ptr; const void* flag_ptr; // pointer to the flag's current value (i.e. FLAGS_foo)
}; };
// Using this inside of a validator is a recipe for a deadlock. // Using this inside of a validator is a recipe for a deadlock.
// TODO(wojtekm) Fix locking when validators are running, to make it safe to // TODO(user) Fix locking when validators are running, to make it safe to
// call validators during ParseAllFlags. // call validators during ParseAllFlags.
// Also make sure then to uncomment the corresponding unit test in // Also make sure then to uncomment the corresponding unit test in
// commandlineflags_unittest.sh // gflags_unittest.sh
extern GFLAGS_DLL_DECL void GetAllFlags(std::vector<CommandLineFlagInfo>* OUTPUT); extern GFLAGS_DLL_DECL void GetAllFlags(std::vector<CommandLineFlagInfo>* OUTPUT);
// These two are actually defined in commandlineflags_reporting.cc. // These two are actually defined in gflags_reporting.cc.
extern GFLAGS_DLL_DECL void ShowUsageWithFlags(const char *argv0); // what --help does extern GFLAGS_DLL_DECL void ShowUsageWithFlags(const char *argv0); // what --help does
extern GFLAGS_DLL_DECL void ShowUsageWithFlagsRestrict(const char *argv0, const char *restrict); extern GFLAGS_DLL_DECL void ShowUsageWithFlagsRestrict(const char *argv0, const char *restrict);
...@@ -231,18 +181,25 @@ extern GFLAGS_DLL_DECL std::string DescribeOneFlag(const CommandLineFlagInfo& fl ...@@ -231,18 +181,25 @@ extern GFLAGS_DLL_DECL std::string DescribeOneFlag(const CommandLineFlagInfo& fl
// Thread-hostile; meant to be called before any threads are spawned. // Thread-hostile; meant to be called before any threads are spawned.
extern GFLAGS_DLL_DECL void SetArgv(int argc, const char** argv); extern GFLAGS_DLL_DECL void SetArgv(int argc, const char** argv);
// The following functions are thread-safe as long as SetArgv() is // The following functions are thread-safe as long as SetArgv() is
// only called before any threads start. // only called before any threads start.
extern GFLAGS_DLL_DECL const std::vector<std::string>& GetArgvs(); // all of argv as a vector extern GFLAGS_DLL_DECL const std::vector<std::string>& GetArgvs();
extern GFLAGS_DLL_DECL const char* GetArgv(); // all of argv as a string extern GFLAGS_DLL_DECL const char* GetArgv(); // all of argv as a string
extern GFLAGS_DLL_DECL const char* GetArgv0(); // only argv0 extern GFLAGS_DLL_DECL const char* GetArgv0(); // only argv0
extern GFLAGS_DLL_DECL uint32 GetArgvSum(); // simple checksum of argv extern GFLAGS_DLL_DECL uint32 GetArgvSum(); // simple checksum of argv
extern GFLAGS_DLL_DECL const char* ProgramInvocationName(); // argv0, or "UNKNOWN" if not set extern GFLAGS_DLL_DECL const char* ProgramInvocationName(); // argv0, or "UNKNOWN" if not set
extern GFLAGS_DLL_DECL const char* ProgramInvocationShortName(); // basename(argv0) extern GFLAGS_DLL_DECL const char* ProgramInvocationShortName(); // basename(argv0)
// ProgramUsage() is thread-safe as long as SetUsageMessage() is only // ProgramUsage() is thread-safe as long as SetUsageMessage() is only
// called before any threads start. // called before any threads start.
extern GFLAGS_DLL_DECL const char* ProgramUsage(); // string set by SetUsageMessage() extern GFLAGS_DLL_DECL const char* ProgramUsage(); // string set by SetUsageMessage()
// VersionString() is thread-safe as long as SetVersionString() is only
// called before any threads start.
extern GFLAGS_DLL_DECL const char* VersionString(); // string set by SetVersionString()
// -------------------------------------------------------------------- // --------------------------------------------------------------------
// Normally you access commandline flags by just saying "if (FLAGS_foo)" // Normally you access commandline flags by just saying "if (FLAGS_foo)"
...@@ -258,8 +215,7 @@ extern GFLAGS_DLL_DECL bool GetCommandLineOption(const char* name, std::string* ...@@ -258,8 +215,7 @@ extern GFLAGS_DLL_DECL bool GetCommandLineOption(const char* name, std::string*
// Return true iff the flagname was found. OUTPUT is set to the flag's // Return true iff the flagname was found. OUTPUT is set to the flag's
// CommandLineFlagInfo or unchanged if we return false. // CommandLineFlagInfo or unchanged if we return false.
extern GFLAGS_DLL_DECL bool GetCommandLineFlagInfo(const char* name, extern GFLAGS_DLL_DECL bool GetCommandLineFlagInfo(const char* name, CommandLineFlagInfo* OUTPUT);
CommandLineFlagInfo* OUTPUT);
// Return the CommandLineFlagInfo of the flagname. exit() if name not found. // Return the CommandLineFlagInfo of the flagname. exit() if name not found.
// Example usage, to check if a flag's value is currently the default value: // Example usage, to check if a flag's value is currently the default value:
...@@ -286,9 +242,8 @@ enum GFLAGS_DLL_DECL FlagSettingMode { ...@@ -286,9 +242,8 @@ enum GFLAGS_DLL_DECL FlagSettingMode {
// non-empty else. // non-empty else.
// SetCommandLineOption uses set_mode == SET_FLAGS_VALUE (the common case) // SetCommandLineOption uses set_mode == SET_FLAGS_VALUE (the common case)
extern GFLAGS_DLL_DECL std::string SetCommandLineOption(const char* name, const char* value); extern GFLAGS_DLL_DECL std::string SetCommandLineOption (const char* name, const char* value);
extern GFLAGS_DLL_DECL std::string SetCommandLineOptionWithMode(const char* name, const char* value, extern GFLAGS_DLL_DECL std::string SetCommandLineOptionWithMode(const char* name, const char* value, FlagSettingMode set_mode);
FlagSettingMode set_mode);
// -------------------------------------------------------------------- // --------------------------------------------------------------------
...@@ -309,12 +264,15 @@ extern GFLAGS_DLL_DECL std::string SetCommandLineOptionWithMode(const char* name ...@@ -309,12 +264,15 @@ extern GFLAGS_DLL_DECL std::string SetCommandLineOptionWithMode(const char* name
// // without worrying about restoring the FLAG values. // // without worrying about restoring the FLAG values.
// } // }
// //
// Note: This class is marked with __attribute__((unused)) because all the // Note: This class is marked with GFLAGS_ATTRIBUTE_UNUSED because all
// work is done in the constructor and destructor, so in the standard // the work is done in the constructor and destructor, so in the standard
// usage example above, the compiler would complain that it's an // usage example above, the compiler would complain that it's an
// unused variable. // unused variable.
// //
// This class is thread-safe. // This class is thread-safe. However, its destructor writes to
// exactly the set of flags that have changed value during its
// lifetime, so concurrent _direct_ access to those flags
// (i.e. FLAGS_foo instead of {Get,Set}CommandLineOption()) is unsafe.
class GFLAGS_DLL_DECL FlagSaver { class GFLAGS_DLL_DECL FlagSaver {
public: public:
...@@ -326,7 +284,7 @@ class GFLAGS_DLL_DECL FlagSaver { ...@@ -326,7 +284,7 @@ class GFLAGS_DLL_DECL FlagSaver {
FlagSaver(const FlagSaver&); // no copying! FlagSaver(const FlagSaver&); // no copying!
void operator=(const FlagSaver&); void operator=(const FlagSaver&);
} ; };
// -------------------------------------------------------------------- // --------------------------------------------------------------------
// Some deprecated or hopefully-soon-to-be-deprecated functions. // Some deprecated or hopefully-soon-to-be-deprecated functions.
...@@ -334,16 +292,15 @@ class GFLAGS_DLL_DECL FlagSaver { ...@@ -334,16 +292,15 @@ class GFLAGS_DLL_DECL FlagSaver {
// This is often used for logging. TODO(csilvers): figure out a better way // This is often used for logging. TODO(csilvers): figure out a better way
extern GFLAGS_DLL_DECL std::string CommandlineFlagsIntoString(); extern GFLAGS_DLL_DECL std::string CommandlineFlagsIntoString();
// Usually where this is used, a FlagSaver should be used instead. // Usually where this is used, a FlagSaver should be used instead.
extern GFLAGS_DLL_DECL bool ReadFlagsFromString(const std::string& flagfilecontents, extern GFLAGS_DLL_DECL
bool ReadFlagsFromString(const std::string& flagfilecontents,
const char* prog_name, const char* prog_name,
bool errors_are_fatal); // uses SET_FLAGS_VALUE bool errors_are_fatal); // uses SET_FLAGS_VALUE
// These let you manually implement --flagfile functionality. // These let you manually implement --flagfile functionality.
// DEPRECATED. // DEPRECATED.
extern GFLAGS_DLL_DECL bool AppendFlagsIntoFile(const std::string& filename, const char* prog_name); extern GFLAGS_DLL_DECL bool AppendFlagsIntoFile(const std::string& filename, const char* prog_name);
extern GFLAGS_DLL_DECL bool SaveCommandFlags(); // actually defined in google.cc ! extern GFLAGS_DLL_DECL bool ReadFromFlagsFile(const std::string& filename, const char* prog_name, bool errors_are_fatal); // uses SET_FLAGS_VALUE
extern GFLAGS_DLL_DECL bool ReadFromFlagsFile(const std::string& filename, const char* prog_name,
bool errors_are_fatal); // uses SET_FLAGS_VALUE
// -------------------------------------------------------------------- // --------------------------------------------------------------------
...@@ -363,7 +320,7 @@ extern GFLAGS_DLL_DECL const char *StringFromEnv(const char *varname, const char ...@@ -363,7 +320,7 @@ extern GFLAGS_DLL_DECL const char *StringFromEnv(const char *varname, const char
// -------------------------------------------------------------------- // --------------------------------------------------------------------
// The next two functions parse commandlineflags from main(): // The next two functions parse gflags from main():
// Set the "usage" message for this program. For example: // Set the "usage" message for this program. For example:
// string usage("This program does nothing. Sample usage:\n"); // string usage("This program does nothing. Sample usage:\n");
...@@ -373,14 +330,20 @@ extern GFLAGS_DLL_DECL const char *StringFromEnv(const char *varname, const char ...@@ -373,14 +330,20 @@ extern GFLAGS_DLL_DECL const char *StringFromEnv(const char *varname, const char
// Thread-hostile; meant to be called before any threads are spawned. // Thread-hostile; meant to be called before any threads are spawned.
extern GFLAGS_DLL_DECL void SetUsageMessage(const std::string& usage); extern GFLAGS_DLL_DECL void SetUsageMessage(const std::string& usage);
// Sets the version string, which is emitted with --version.
// For instance: SetVersionString("1.3");
// Thread-hostile; meant to be called before any threads are spawned.
extern GFLAGS_DLL_DECL void SetVersionString(const std::string& version);
// Looks for flags in argv and parses them. Rearranges argv to put // Looks for flags in argv and parses them. Rearranges argv to put
// flags first, or removes them entirely if remove_flags is true. // flags first, or removes them entirely if remove_flags is true.
// If a flag is defined more than once in the command line or flag // If a flag is defined more than once in the command line or flag
// file, the last definition is used. // file, the last definition is used. Returns the index (into argv)
// of the first non-flag argument.
// See top-of-file for more details on this function. // See top-of-file for more details on this function.
#ifndef SWIG // In swig, use ParseCommandLineFlagsScript() instead. #ifndef SWIG // In swig, use ParseCommandLineFlagsScript() instead.
extern GFLAGS_DLL_DECL uint32 ParseCommandLineFlags(int *argc, char*** argv, extern GFLAGS_DLL_DECL uint32 ParseCommandLineFlags(int *argc, char*** argv, bool remove_flags);
bool remove_flags);
#endif #endif
...@@ -390,15 +353,16 @@ extern GFLAGS_DLL_DECL uint32 ParseCommandLineFlags(int *argc, char*** argv, ...@@ -390,15 +353,16 @@ extern GFLAGS_DLL_DECL uint32 ParseCommandLineFlags(int *argc, char*** argv,
// changing default values for some FLAGS (via // changing default values for some FLAGS (via
// e.g. SetCommandLineOptionWithMode calls) between the time of // e.g. SetCommandLineOptionWithMode calls) between the time of
// command line parsing and the time of dumping help information for // command line parsing and the time of dumping help information for
// the flags as a result of command line parsing. // the flags as a result of command line parsing. If a flag is
// If a flag is defined more than once in the command line or flag // defined more than once in the command line or flag file, the last
// file, the last definition is used. // definition is used. Returns the index (into argv) of the first
extern GFLAGS_DLL_DECL uint32 ParseCommandLineNonHelpFlags(int *argc, char*** argv, // non-flag argument. (If remove_flags is true, will always return 1.)
bool remove_flags); extern GFLAGS_DLL_DECL uint32 ParseCommandLineNonHelpFlags(int *argc, char*** argv, bool remove_flags);
// This is actually defined in commandlineflags_reporting.cc.
// This is actually defined in gflags_reporting.cc.
// This function is misnamed (it also handles --version, etc.), but // This function is misnamed (it also handles --version, etc.), but
// it's too late to change that now. :-( // it's too late to change that now. :-(
extern GFLAGS_DLL_DECL void HandleCommandLineHelpFlags(); // in commandlineflags_reporting.cc extern GFLAGS_DLL_DECL void HandleCommandLineHelpFlags(); // in gflags_reporting.cc
// Allow command line reparsing. Disables the error normally // Allow command line reparsing. Disables the error normally
// generated when an unknown flag is found, since it may be found in a // generated when an unknown flag is found, since it may be found in a
...@@ -406,10 +370,10 @@ extern GFLAGS_DLL_DECL void HandleCommandLineHelpFlags(); // in commandlinefla ...@@ -406,10 +370,10 @@ extern GFLAGS_DLL_DECL void HandleCommandLineHelpFlags(); // in commandlinefla
// are spawned. // are spawned.
extern GFLAGS_DLL_DECL void AllowCommandLineReparsing(); extern GFLAGS_DLL_DECL void AllowCommandLineReparsing();
// Reparse the flags that have not yet been recognized. // Reparse the flags that have not yet been recognized. Only flags
// Only flags registered since the last parse will be recognized. // registered since the last parse will be recognized. Any flag value
// Any flag value must be provided as part of the argument using "=", // must be provided as part of the argument using "=", not as a
// not as a separate command line argument that follows the flag argument. // separate command line argument that follows the flag argument.
// Intended for handling flags from dynamically loaded libraries, // Intended for handling flags from dynamically loaded libraries,
// since their flags are not registered until they are loaded. // since their flags are not registered until they are loaded.
extern GFLAGS_DLL_DECL void ReparseCommandLineNonHelpFlags(); extern GFLAGS_DLL_DECL void ReparseCommandLineNonHelpFlags();
...@@ -417,11 +381,12 @@ extern GFLAGS_DLL_DECL void ReparseCommandLineNonHelpFlags(); ...@@ -417,11 +381,12 @@ extern GFLAGS_DLL_DECL void ReparseCommandLineNonHelpFlags();
// Clean up memory allocated by flags. This is only needed to reduce // Clean up memory allocated by flags. This is only needed to reduce
// the quantity of "potentially leaked" reports emitted by memory // the quantity of "potentially leaked" reports emitted by memory
// debugging tools such as valgrind. It is not required for normal // debugging tools such as valgrind. It is not required for normal
// operation, or for the perftools heap-checker. It must only be called // operation, or for the google perftools heap-checker. It must only
// when the process is about to exit, and all threads that might // be called when the process is about to exit, and all threads that
// access flags are quiescent. Referencing flags after this is called // might access flags are quiescent. Referencing flags after this is
// will have unexpected consequences. This is not safe to run when // called will have unexpected consequences. This is not safe to run
// multiple threads might be running: the function is thread-hostile. // when multiple threads might be running: the function is
// thread-hostile.
extern GFLAGS_DLL_DECL void ShutDownCommandLineFlags(); extern GFLAGS_DLL_DECL void ShutDownCommandLineFlags();
...@@ -453,7 +418,7 @@ extern GFLAGS_DLL_DECL void ShutDownCommandLineFlags(); ...@@ -453,7 +418,7 @@ extern GFLAGS_DLL_DECL void ShutDownCommandLineFlags();
// directly. The idea is that DEFINE puts the flag in the weird // directly. The idea is that DEFINE puts the flag in the weird
// namespace, and DECLARE imports the flag from there into the current // namespace, and DECLARE imports the flag from there into the current
// namespace. The net result is to force people to use DECLARE to get // namespace. The net result is to force people to use DECLARE to get
// access to a flag, rather than saying "extern bool FLAGS_whatever;" // access to a flag, rather than saying "extern GFLAGS_DLL_DECL bool FLAGS_whatever;"
// or some such instead. We want this so we can put extra // or some such instead. We want this so we can put extra
// functionality (like sanity-checking) in DECLARE if we want, and // functionality (like sanity-checking) in DECLARE if we want, and
// make sure it is picked up everywhere. // make sure it is picked up everywhere.
...@@ -469,22 +434,23 @@ class GFLAGS_DLL_DECL FlagRegisterer { ...@@ -469,22 +434,23 @@ class GFLAGS_DLL_DECL FlagRegisterer {
void* current_storage, void* defvalue_storage); void* current_storage, void* defvalue_storage);
}; };
extern bool FlagsTypeWarn(const char *name);
// If your application #defines STRIP_FLAG_HELP to a non-zero value // If your application #defines STRIP_FLAG_HELP to a non-zero value
// before #including this file, we remove the help message from the // before #including this file, we remove the help message from the
// binary file. This can reduce the size of the resulting binary // binary file. This can reduce the size of the resulting binary
// somewhat, and may also be useful for security reasons. // somewhat, and may also be useful for security reasons.
extern const char kStrippedFlagHelp[]; extern GFLAGS_DLL_DECL const char kStrippedFlagHelp[];
} // namespace GFLAGS_NAMESPACE
}
#ifndef SWIG // In swig, ignore the main flag declarations #ifndef SWIG // In swig, ignore the main flag declarations
#if defined(STRIP_FLAG_HELP) && STRIP_FLAG_HELP > 0 #if defined(STRIP_FLAG_HELP) && STRIP_FLAG_HELP > 0
// Need this construct to avoid the 'defined but not used' warning. // Need this construct to avoid the 'defined but not used' warning.
#define MAYBE_STRIPPED_HELP(txt) (false ? (txt) : kStrippedFlagHelp) #define MAYBE_STRIPPED_HELP(txt) \
(false ? (txt) : GFLAGS_NAMESPACE::kStrippedFlagHelp)
#else #else
#define MAYBE_STRIPPED_HELP(txt) txt #define MAYBE_STRIPPED_HELP(txt) txt
#endif #endif
...@@ -506,19 +472,12 @@ extern const char kStrippedFlagHelp[]; ...@@ -506,19 +472,12 @@ extern const char kStrippedFlagHelp[];
/* We always want to export defined variables, dll or no */ \ /* We always want to export defined variables, dll or no */ \
GFLAGS_DLL_DEFINE_FLAG type FLAGS_##name = FLAGS_nono##name; \ GFLAGS_DLL_DEFINE_FLAG type FLAGS_##name = FLAGS_nono##name; \
type FLAGS_no##name = FLAGS_nono##name; \ type FLAGS_no##name = FLAGS_nono##name; \
static ::google::FlagRegisterer o_##name( \ static GFLAGS_NAMESPACE::FlagRegisterer o_##name( \
#name, #type, MAYBE_STRIPPED_HELP(help), __FILE__, \ #name, #type, MAYBE_STRIPPED_HELP(help), __FILE__, \
&FLAGS_##name, &FLAGS_no##name); \ &FLAGS_##name, &FLAGS_no##name); \
} \ } \
using fL##shorttype::FLAGS_##name using fL##shorttype::FLAGS_##name
#define DECLARE_VARIABLE(type, shorttype, name) \
namespace fL##shorttype { \
/* We always want to import declared variables, dll or no */ \
extern GFLAGS_DLL_DECLARE_FLAG type FLAGS_##name; \
} \
using fL##shorttype::FLAGS_##name
// For DEFINE_bool, we want to do the extra check that the passed-in // For DEFINE_bool, we want to do the extra check that the passed-in
// value is actually a bool, and not a string or something that can be // value is actually a bool, and not a string or something that can be
// coerced to a bool. These declarations (no definition needed!) will // coerced to a bool. These declarations (no definition needed!) will
...@@ -526,34 +485,39 @@ extern const char kStrippedFlagHelp[]; ...@@ -526,34 +485,39 @@ extern const char kStrippedFlagHelp[];
// We'll use 'sizeof(IsBool(val))' to distinguish. This code requires // We'll use 'sizeof(IsBool(val))' to distinguish. This code requires
// that the compiler have different sizes for bool & double. Since // that the compiler have different sizes for bool & double. Since
// this is not guaranteed by the standard, we check it with a // this is not guaranteed by the standard, we check it with a
// compile-time assert (msg[-1] will give a compile-time error). // COMPILE_ASSERT.
namespace fLB { namespace fLB {
struct CompileAssert {}; struct CompileAssert {};
typedef CompileAssert expected_sizeof_double_neq_sizeof_bool[ typedef CompileAssert expected_sizeof_double_neq_sizeof_bool[
(sizeof(double) != sizeof(bool)) ? 1 : -1]; (sizeof(double) != sizeof(bool)) ? 1 : -1];
template<typename From> GFLAGS_DLL_DECL double IsBoolFlag(const From& from); template<typename From> double GFLAGS_DLL_DECL IsBoolFlag(const From& from);
GFLAGS_DLL_DECL bool IsBoolFlag(bool from); GFLAGS_DLL_DECL bool IsBoolFlag(bool from);
} // namespace fLB } // namespace fLB
#define DECLARE_bool(name) DECLARE_VARIABLE(bool, B, name) // Here are the actual DEFINE_*-macros. The respective DECLARE_*-macros
// are in a separate include, gflags_declare.h, for reducing
// the physical transitive size for DECLARE use.
#define DEFINE_bool(name, val, txt) \ #define DEFINE_bool(name, val, txt) \
namespace fLB { \ namespace fLB { \
typedef ::fLB::CompileAssert FLAG_##name##_value_is_not_a_bool[ \ typedef ::fLB::CompileAssert FLAG_##name##_value_is_not_a_bool[ \
(sizeof(::fLB::IsBoolFlag(val)) != sizeof(double)) ? 1 : -1]; \ (sizeof(::fLB::IsBoolFlag(val)) != sizeof(double))? 1: -1]; \
} \ } \
DEFINE_VARIABLE(bool, B, name, val, txt) DEFINE_VARIABLE(bool, B, name, val, txt)
#define DECLARE_int32(name) DECLARE_VARIABLE(::google::int32, I, name) #define DEFINE_int32(name, val, txt) \
#define DEFINE_int32(name,val,txt) DEFINE_VARIABLE(::google::int32, I, name, val, txt) DEFINE_VARIABLE(GFLAGS_NAMESPACE::int32, I, \
name, val, txt)
#define DECLARE_int64(name) DECLARE_VARIABLE(::google::int64, I64, name) #define DEFINE_int64(name, val, txt) \
#define DEFINE_int64(name,val,txt) DEFINE_VARIABLE(::google::int64, I64, name, val, txt) DEFINE_VARIABLE(GFLAGS_NAMESPACE::int64, I64, \
name, val, txt)
#define DECLARE_uint64(name) DECLARE_VARIABLE(::google::uint64, U64, name) #define DEFINE_uint64(name,val, txt) \
#define DEFINE_uint64(name,val,txt) DEFINE_VARIABLE(::google::uint64, U64, name, val, txt) DEFINE_VARIABLE(GFLAGS_NAMESPACE::uint64, U64, \
name, val, txt)
#define DECLARE_double(name) DECLARE_VARIABLE(double, D, name) #define DEFINE_double(name, val, txt) \
#define DEFINE_double(name, val, txt) DEFINE_VARIABLE(double, D, name, val, txt) DEFINE_VARIABLE(double, D, name, val, txt)
// Strings are trickier, because they're not a POD, so we can't // Strings are trickier, because they're not a POD, so we can't
// construct them at static-initialization time (instead they get // construct them at static-initialization time (instead they get
...@@ -563,11 +527,6 @@ GFLAGS_DLL_DECL bool IsBoolFlag(bool from); ...@@ -563,11 +527,6 @@ GFLAGS_DLL_DECL bool IsBoolFlag(bool from);
// into it later. It's not perfect, but the best we can do. // into it later. It's not perfect, but the best we can do.
namespace fLS { namespace fLS {
// The meaning of "string" might be different between now and when the
// macros below get invoked (e.g., if someone is experimenting with
// other string implementations that get defined after this file is
// included). Save the current meaning now and use it in the macros.
typedef std::string clstring;
inline clstring* dont_pass0toDEFINE_string(char *stringspot, inline clstring* dont_pass0toDEFINE_string(char *stringspot,
const char *value) { const char *value) {
...@@ -581,13 +540,13 @@ inline clstring* dont_pass0toDEFINE_string(char *stringspot, ...@@ -581,13 +540,13 @@ inline clstring* dont_pass0toDEFINE_string(char *stringspot,
int value); int value);
} // namespace fLS } // namespace fLS
#define DECLARE_string(name) namespace fLS { extern GFLAGS_DLL_DECLARE_FLAG ::fLS::clstring& FLAGS_##name; } \
using fLS::FLAGS_##name
// We need to define a var named FLAGS_no##name so people don't define // We need to define a var named FLAGS_no##name so people don't define
// --string and --nostring. And we need a temporary place to put val // --string and --nostring. And we need a temporary place to put val
// so we don't have to evaluate it twice. Two great needs that go // so we don't have to evaluate it twice. Two great needs that go
// great together! // great together!
// The weird 'using' + 'extern' inside the fLS namespace is to work around
// an unknown compiler bug/issue with the gcc 4.2.1 on SUSE 10. See
// http://code.google.com/p/google-gflags/issues/detail?id=20
#define DEFINE_string(name, val, txt) \ #define DEFINE_string(name, val, txt) \
namespace fLS { \ namespace fLS { \
using ::fLS::clstring; \ using ::fLS::clstring; \
...@@ -595,13 +554,20 @@ inline clstring* dont_pass0toDEFINE_string(char *stringspot, ...@@ -595,13 +554,20 @@ inline clstring* dont_pass0toDEFINE_string(char *stringspot,
clstring* const FLAGS_no##name = ::fLS:: \ clstring* const FLAGS_no##name = ::fLS:: \
dont_pass0toDEFINE_string(s_##name[0].s, \ dont_pass0toDEFINE_string(s_##name[0].s, \
val); \ val); \
static ::google::FlagRegisterer o_##name( \ static GFLAGS_NAMESPACE::FlagRegisterer o_##name( \
#name, "string", MAYBE_STRIPPED_HELP(txt), __FILE__, \ #name, "string", MAYBE_STRIPPED_HELP(txt), __FILE__, \
s_##name[0].s, new (s_##name[1].s) clstring(*FLAGS_no##name)); \ s_##name[0].s, new (s_##name[1].s) clstring(*FLAGS_no##name)); \
GFLAGS_DLL_DEFINE_FLAG clstring& FLAGS_##name = *FLAGS_no##name; \ extern GFLAGS_DLL_DEFINE_FLAG clstring& FLAGS_##name; \
using fLS::FLAGS_##name; \
clstring& FLAGS_##name = *FLAGS_no##name; \
} \ } \
using fLS::FLAGS_##name using fLS::FLAGS_##name
#endif // SWIG #endif // SWIG
#endif // GOOGLE_GFLAGS_H_
// Import gflags library symbols into alternative/deprecated namespace(s)
#include "gflags_gflags.h"
#endif // GFLAGS_GFLAGS_H_
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// //
// --- // ---
// Author: Dave Nicponski
// //
// Implement helpful bash-style command line flag completions // Implement helpful bash-style command line flag completions
// //
...@@ -89,7 +89,7 @@ ...@@ -89,7 +89,7 @@
/* /*
$ complete -o bashdefault -o default -o nospace -C \ $ complete -o bashdefault -o default -o nospace -C \
'/usr/local/bin/gflags_completions.sh --tab_completion_columns $COLUMNS' \ '/home/build/eng/bash/bash_completions.sh --tab_completion_columns $COLUMNS' \
time env binary_name another_binary [...] time env binary_name another_binary [...]
*/ */
...@@ -109,22 +109,13 @@ $ complete -o bashdefault -o default -o nospace -C \ ...@@ -109,22 +109,13 @@ $ complete -o bashdefault -o default -o nospace -C \
// produce the expected completion output. // produce the expected completion output.
#ifndef GOOGLE_GFLAGS_COMPLETIONS_H_ #ifndef GFLAGS_COMPLETIONS_H_
#define GOOGLE_GFLAGS_COMPLETIONS_H_ #define GFLAGS_COMPLETIONS_H_
// Annoying stuff for windows -- makes sure clients can import these functions
#ifndef GFLAGS_DLL_DECL
# ifdef _WIN32
# define GFLAGS_DLL_DECL __declspec(dllimport)
# else
# define GFLAGS_DLL_DECL
# endif
#endif
namespace google { namespace google {
GFLAGS_DLL_DECL void HandleCommandLineCompletions(void); extern void HandleCommandLineCompletions(void);
} }
#endif // GOOGLE_GFLAGS_COMPLETIONS_H_ #endif // GFLAGS_COMPLETIONS_H_
// Copyright (c) 1999, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// ---
//
// Revamped and reorganized by Craig Silverstein
//
// This is the file that should be included by any file which declares
// command line flag.
#ifndef GFLAGS_DECLARE_H_
#define GFLAGS_DECLARE_H_
// ---------------------------------------------------------------------------
// Namespace of gflags library symbols.
#define GFLAGS_NAMESPACE google
// ---------------------------------------------------------------------------
// Windows DLL import/export.
// We always want to import the symbols of the gflags library
#ifndef GFLAGS_DLL_DECL
# if 0 && defined(_MSC_VER)
# define GFLAGS_DLL_DECL __declspec(dllimport)
# else
# define GFLAGS_DLL_DECL
# endif
#endif
// We always want to import variables declared in user code
#ifndef GFLAGS_DLL_DECLARE_FLAG
# ifdef _MSC_VER
# define GFLAGS_DLL_DECLARE_FLAG __declspec(dllimport)
# else
# define GFLAGS_DLL_DECLARE_FLAG
# endif
#endif
// ---------------------------------------------------------------------------
// Flag types
#include <string>
#if 1
# include <stdint.h> // the normal place uint32_t is defined
#elif 1
# include <sys/types.h> // the normal place u_int32_t is defined
#elif 0
# include <inttypes.h> // a third place for uint32_t or u_int32_t
#endif
namespace GFLAGS_NAMESPACE {
#if 0 // C99
typedef int32_t int32;
typedef uint32_t uint32;
typedef int64_t int64;
typedef uint64_t uint64;
#elif 0 // BSD
typedef int32_t int32;
typedef u_int32_t uint32;
typedef int64_t int64;
typedef u_int64_t uint64;
#elif 1 // Windows
typedef __int32 int32;
typedef unsigned __int32 uint32;
typedef __int64 int64;
typedef unsigned __int64 uint64;
#else
# error Do not know how to define a 32-bit integer quantity on your system
#endif
} // namespace GFLAGS_NAMESPACE
namespace fLS {
// The meaning of "string" might be different between now and when the
// macros below get invoked (e.g., if someone is experimenting with
// other string implementations that get defined after this file is
// included). Save the current meaning now and use it in the macros.
typedef std::string clstring;
} // namespace fLS
#define DECLARE_VARIABLE(type, shorttype, name) \
/* We always want to import declared variables, dll or no */ \
namespace fL##shorttype { extern GFLAGS_DLL_DECLARE_FLAG type FLAGS_##name; } \
using fL##shorttype::FLAGS_##name
#define DECLARE_bool(name) \
DECLARE_VARIABLE(bool, B, name)
#define DECLARE_int32(name) \
DECLARE_VARIABLE(::GFLAGS_NAMESPACE::int32, I, name)
#define DECLARE_int64(name) \
DECLARE_VARIABLE(::GFLAGS_NAMESPACE::int64, I64, name)
#define DECLARE_uint64(name) \
DECLARE_VARIABLE(::GFLAGS_NAMESPACE::uint64, U64, name)
#define DECLARE_double(name) \
DECLARE_VARIABLE(double, D, name)
#define DECLARE_string(name) \
/* We always want to import declared variables, dll or no */ \
namespace fLS { \
using ::fLS::clstring; \
extern GFLAGS_DLL_DECLARE_FLAG ::fLS::clstring& FLAGS_##name; \
} \
using fLS::FLAGS_##name
#endif // GFLAGS_DECLARE_H_
// Copyright (c) 2014, Andreas Schuh
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// -----------------------------------------------------------------------------
// Imports the gflags library symbols into an alternative/deprecated namespace.
#ifndef GFLAGS_GFLAGS_H_
# error The internal header gflags_gflags.h may only be included by gflags.h
#endif
#ifndef GFLAGS_NS_GFLAGS_H_
#define GFLAGS_NS_GFLAGS_H_
namespace gflags {
using GFLAGS_NAMESPACE::int32;
using GFLAGS_NAMESPACE::uint32;
using GFLAGS_NAMESPACE::int64;
using GFLAGS_NAMESPACE::uint64;
using GFLAGS_NAMESPACE::RegisterFlagValidator;
using GFLAGS_NAMESPACE::CommandLineFlagInfo;
using GFLAGS_NAMESPACE::GetAllFlags;
using GFLAGS_NAMESPACE::ShowUsageWithFlags;
using GFLAGS_NAMESPACE::ShowUsageWithFlagsRestrict;
using GFLAGS_NAMESPACE::DescribeOneFlag;
using GFLAGS_NAMESPACE::SetArgv;
using GFLAGS_NAMESPACE::GetArgvs;
using GFLAGS_NAMESPACE::GetArgv;
using GFLAGS_NAMESPACE::GetArgv0;
using GFLAGS_NAMESPACE::GetArgvSum;
using GFLAGS_NAMESPACE::ProgramInvocationName;
using GFLAGS_NAMESPACE::ProgramInvocationShortName;
using GFLAGS_NAMESPACE::ProgramUsage;
using GFLAGS_NAMESPACE::VersionString;
using GFLAGS_NAMESPACE::GetCommandLineOption;
using GFLAGS_NAMESPACE::GetCommandLineFlagInfo;
using GFLAGS_NAMESPACE::GetCommandLineFlagInfoOrDie;
using GFLAGS_NAMESPACE::FlagSettingMode;
using GFLAGS_NAMESPACE::SET_FLAGS_VALUE;
using GFLAGS_NAMESPACE::SET_FLAG_IF_DEFAULT;
using GFLAGS_NAMESPACE::SET_FLAGS_DEFAULT;
using GFLAGS_NAMESPACE::SetCommandLineOption;
using GFLAGS_NAMESPACE::SetCommandLineOptionWithMode;
using GFLAGS_NAMESPACE::FlagSaver;
using GFLAGS_NAMESPACE::CommandlineFlagsIntoString;
using GFLAGS_NAMESPACE::ReadFlagsFromString;
using GFLAGS_NAMESPACE::AppendFlagsIntoFile;
using GFLAGS_NAMESPACE::ReadFromFlagsFile;
using GFLAGS_NAMESPACE::BoolFromEnv;
using GFLAGS_NAMESPACE::Int32FromEnv;
using GFLAGS_NAMESPACE::Int64FromEnv;
using GFLAGS_NAMESPACE::Uint64FromEnv;
using GFLAGS_NAMESPACE::DoubleFromEnv;
using GFLAGS_NAMESPACE::StringFromEnv;
using GFLAGS_NAMESPACE::SetUsageMessage;
using GFLAGS_NAMESPACE::SetVersionString;
using GFLAGS_NAMESPACE::ParseCommandLineNonHelpFlags;
using GFLAGS_NAMESPACE::HandleCommandLineHelpFlags;
using GFLAGS_NAMESPACE::AllowCommandLineReparsing;
using GFLAGS_NAMESPACE::ReparseCommandLineNonHelpFlags;
using GFLAGS_NAMESPACE::ShutDownCommandLineFlags;
using GFLAGS_NAMESPACE::FlagRegisterer;
#ifndef SWIG
using GFLAGS_NAMESPACE::ParseCommandLineFlags;
#endif
} // namespace gflags
#endif // GFLAGS_NS_GFLAGS_H_
/* src/config.h.in. Generated from configure.ac by autoheader. */ /* Generated from config.h.in during build configuration using CMake. */
/* Sometimes we accidentally #include this config.h instead of the one
in .. -- this is particularly true for msys/mingw, which uses the
unix config.h but also runs code in the windows directory.
*/
#ifdef __MINGW32__
#include "../config.h"
#define GOOGLE_GFLAGS_WINDOWS_CONFIG_H_
#endif
#ifndef GOOGLE_GFLAGS_WINDOWS_CONFIG_H_
#define GOOGLE_GFLAGS_WINDOWS_CONFIG_H_
/* Always the empty-string on non-windows systems. On windows, should be
"__declspec(dllexport)". This way, when we compile the dll, we export our
functions/classes. It's safe to define this here because config.h is only
used internally, to compile the DLL, and every DLL source file #includes
"config.h" before anything else. */
#ifndef GFLAGS_DLL_DECL
# define GFLAGS_IS_A_DLL 1 /* not set if you're statically linking */
# define GFLAGS_DLL_DECL __declspec(dllexport)
# define GFLAGS_DLL_DECL_FOR_UNITTESTS __declspec(dllimport)
#endif
/* Namespace for Google classes */
#define GOOGLE_NAMESPACE ::google
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
/* Define to 1 if you have the <fnmatch.h> header file. */
#undef HAVE_FNMATCH_H
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* define if the compiler implements namespaces */ // Note: This header file is only used internally. It is not part of public interface!
#define HAVE_NAMESPACES 1
/* Define if you have POSIX threads libraries and header files. */ // ---------------------------------------------------------------------------
#undef HAVE_PTHREAD // System checks
/* Define to 1 if you have the `putenv' function. */ // Define if you build this library for a MS Windows OS.
#define HAVE_PUTENV 1 #define OS_WINDOWS
/* Define to 1 if you have the `setenv' function. */ // Define if you have the <stdint.h> header file.
#undef HAVE_SETENV #define HAVE_STDINT_H
/* Define to 1 if you have the <stdint.h> header file. */ // Define if you have the <sys/types.h> header file.
#undef HAVE_STDINT_H #define HAVE_SYS_TYPES_H
/* Define to 1 if you have the <stdlib.h> header file. */ // Define if you have the <inttypes.h> header file.
#define HAVE_STDLIB_H 1 /* #undef HAVE_INTTYPES_H */
/* Define to 1 if you have the <strings.h> header file. */ // Define if you have the <sys/stat.h> header file.
#undef HAVE_STRINGS_H #define HAVE_SYS_STAT_H
/* Define to 1 if you have the <string.h> header file. */ // Define if you have the <unistd.h> header file.
#define HAVE_STRING_H 1 /* #undef HAVE_UNISTD_H */
/* Define to 1 if you have the `strtoll' function. */ // Define if you have the <fnmatch.h> header file.
#define HAVE_STRTOLL 1 /* #undef HAVE_FNMATCH_H */
/* Define to 1 if you have the `strtoq' function. */ // Define if you have the <shlwapi.h> header file (Windows 2000/XP).
#define HAVE_STRTOQ 1 #define HAVE_SHLWAPI_H
/* Define to 1 if you have the <sys/stat.h> header file. */ // Define if you have the strtoll function.
#define HAVE_SYS_STAT_H 1 /* #undef HAVE_STRTOLL */
/* Define to 1 if you have the <sys/types.h> header file. */ // Define if you have the strtoq function.
#define HAVE_SYS_TYPES_H 1 /* #undef HAVE_STRTOQ */
/* Define to 1 if you have the <unistd.h> header file. */ // Define if you have the <pthread.h> header file.
#undef HAVE_UNISTD_H /* #undef HAVE_PTHREAD */
/* define if your compiler has __attribute__ */ // Define if your pthread library defines the type pthread_rwlock_t
#undef HAVE___ATTRIBUTE__ /* #undef HAVE_RWLOCK */
/* Define to the sub-directory in which libtool stores uninstalled libraries. // gcc requires this to get PRId64, etc.
*/ #if defined(HAVE_INTTYPES_H) && !defined(__STDC_FORMAT_MACROS)
#undef LT_OBJDIR # define __STDC_FORMAT_MACROS 1
#endif
/* Name of package */
#undef PACKAGE
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */ // ---------------------------------------------------------------------------
#undef PACKAGE_TARNAME // Package information
/* Define to the home page for this package. */ // Name of package.
#undef PACKAGE_URL #define PACKAGE gflags
/* Define to the version of this package. */ // Define to the full name of this package.
#undef PACKAGE_VERSION #define PACKAGE_NAME gflags
/* Define to necessary symbol if this constant uses a non-standard name on // Define to the full name and version of this package.
your system. */ #define PACKAGE_STRING gflags 2.2.0
#undef PTHREAD_CREATE_JOINABLE
/* Define to 1 if you have the ANSI C header files. */ // Define to the one symbol short name of this package.
#define STDC_HEADERS 1 #define PACKAGE_TARNAME gflags-2.2.0
/* the namespace where STL code like vector<> is defined */ // Define to the version of this package.
#define STL_NAMESPACE std #define PACKAGE_VERSION 2.2.0
/* Version number of package */ // Version number of package.
#undef VERSION #define VERSION PACKAGE_VERSION
/* Stops putting the code inside the Google namespace */ // Define to the address where bug reports for this package should be sent.
#define _END_GOOGLE_NAMESPACE_ } #define PACKAGE_BUGREPORT https://github.com/schuhschuh/gflags/issues
/* Puts following code inside the Google namespace */ // ---------------------------------------------------------------------------
#define _START_GOOGLE_NAMESPACE_ namespace google { // Path separator
#ifndef PATH_SEPARATOR
# ifdef OS_WINDOWS
# define PATH_SEPARATOR '\\'
# else
# define PATH_SEPARATOR '/'
# endif
#endif
// --------------------------------------------------------------------- // ---------------------------------------------------------------------------
// Extra stuff not found in config.h.in // Windows
// This must be defined before the windows.h is included. It's needed // Whether gflags library is a DLL.
// for mutex.h, to give access to the TryLock method. #ifndef GFLAGS_IS_A_DLL
#ifndef _WIN32_WINNT # define GFLAGS_IS_A_DLL 0
# define _WIN32_WINNT 0x0400
#endif #endif
// TODO(csilvers): include windows/port.h in every relevant source file instead? // Always export symbols when compiling a shared library as this file is only
#include "windows/port.h" // included by internal modules when building the gflags library itself.
// The gflags_declare.h header file will set it to import these symbols otherwise.
#ifndef GFLAGS_DLL_DECL
# if GFLAGS_IS_A_DLL && defined(_MSC_VER)
# define GFLAGS_DLL_DECL __declspec(dllexport)
# else
# define GFLAGS_DLL_DECL
# endif
#endif
// Flags defined by the gflags library itself must be exported
#ifndef GFLAGS_DLL_DEFINE_FLAG
# define GFLAGS_DLL_DEFINE_FLAG GFLAGS_DLL_DECL
#endif
#endif /* GOOGLE_GFLAGS_WINDOWS_CONFIG_H_ */ #ifdef OS_WINDOWS
// The unittests import the symbols of the shared gflags library
# if GFLAGS_IS_A_DLL && defined(_MSC_VER)
# define GFLAGS_DLL_DECL_FOR_UNITTESTS __declspec(dllimport)
# endif
# include "windows_port.h"
#endif
...@@ -25,9 +25,9 @@ ...@@ -25,9 +25,9 @@
'target_name': 'gflags', 'target_name': 'gflags',
'type': 'static_library', 'type': 'static_library',
'include_dirs': [ 'include_dirs': [
'<(gflags_gen_arch_root)/include/gflags', # For configured files.
'<(gflags_gen_arch_root)/include/private', # For config.h '<(gflags_gen_arch_root)/include/private', # For config.h
'<(gflags_gen_arch_root)/include', # For configured files. '<(gflags_root)/src/src', # For everything else.
'<(gflags_root)/src', # For everything else.
], ],
'defines': [ 'defines': [
# These macros exist so flags and symbols are properly # These macros exist so flags and symbols are properly
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
'direct_dependent_settings': { 'direct_dependent_settings': {
'include_dirs': [ 'include_dirs': [
'<(gflags_gen_arch_root)/include', # For configured files. '<(gflags_gen_arch_root)/include', # For configured files.
'<(gflags_root)/src', # For everything else. '<(gflags_root)/src/src', # For everything else.
], ],
'defines': [ 'defines': [
'GFLAGS_DLL_DECL=', 'GFLAGS_DLL_DECL=',
...@@ -49,42 +49,44 @@ ...@@ -49,42 +49,44 @@
], ],
}, },
'sources': [ 'sources': [
'src/gflags.cc', 'src/src/gflags.cc',
'src/gflags_completions.cc', 'src/src/gflags_completions.cc',
'src/gflags_reporting.cc', 'src/src/gflags_reporting.cc',
], ],
'conditions': [ 'conditions': [
['OS=="win"', { ['OS=="win"', {
'sources': [ 'sources': [
'src/windows/port.cc', 'src/src/windows_port.cc',
],
'msvs_disabled_warnings': [
4005, # WIN32_LEAN_AND_MEAN redefinition.
4267, # Conversion from size_t to "type".
], ],
# Suppress warnings about WIN32_LEAN_AND_MEAN and size_t truncation. 'configurations': {
'msvs_disabled_warnings': [4005, 4267], 'Common_Base': {
'msvs_configuration_attributes': {
'CharacterSet': '2', # Use Multi-byte Character Set.
},
},
},
}], }],
# TODO(andrew): Look into fixing this warning upstream: # TODO(andrew): Look into fixing this warning upstream:
# http://code.google.com/p/webrtc/issues/detail?id=760 # http://code.google.com/p/webrtc/issues/detail?id=760
['OS=="win" and clang==1', { ['OS=="win" and clang==1', {
'msvs_settings': { 'msvs_settings': {
'VCCLCompilerTool': { 'VCCLCompilerTool': {
'AdditionalOptions!': [
'-Wheader-hygiene', # Suppress warning about using namespace.
],
'AdditionalOptions': [ 'AdditionalOptions': [
'-Wno-unused-local-typedef', # Suppress unused private typedef. '-Wno-microsoft-include',
], ],
}, },
}, },
}], }],
['clang==1', { ['clang==1', {
'cflags': ['-Wno-unused-local-typedef',], 'cflags': [
'cflags!': ['-Wheader-hygiene',], '-Wno-microsoft-include',
'xcode_settings': { ],
'WARNING_CFLAGS': ['-Wno-unused-local-typedef',],
'WARNING_CFLAGS!': ['-Wheader-hygiene',],
},
}], }],
], ],
}, },
], ],
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment