Export of internal Abseil changes

--
c99f979ad34f155fbeeea69b88bdc7458d89a21c by Derek Mauro <dmauro@google.com>:

Remove a floating point division by zero test.

This isn't testing behavior related to the library, and MSVC warns
about it in opt mode.

PiperOrigin-RevId: 285220804

--
68b015491f0dbf1ab547994673281abd1f34cd4b by Gennadiy Rozental <rogeeff@google.com>:

This CL introduces following changes to the class FlagImpl:
* We eliminate the CommandLineFlagLocks struct. Instead callback guard and callback function are combined into a single CallbackData struct, while primary data lock is stored separately.
* CallbackData member of class FlagImpl is initially set to be nullptr and is only allocated and initialized when a flag's callback is being set. For most flags we do not pay for the extra space and extra absl::Mutex now.
* Primary data guard is stored in data_guard_ data member. This is a properly aligned character buffer of necessary size. During initialization of the flag we construct absl::Mutex in this space using placement new call.
* We now avoid extra value copy after successful attempt to parse value out of string. Instead we swap flag's current value with tentative value we just produced.

PiperOrigin-RevId: 285132636

--
ed45d118fb818969eb13094cf7827c885dfc562c by Tom Manshreck <shreck@google.com>:

Change null-term* (and nul-term*) to NUL-term* in comments

PiperOrigin-RevId: 285036610

--
729619017944db895ce8d6d29c1995aa2e5628a5 by Derek Mauro <dmauro@google.com>:

Use the Posix implementation of thread identity on MinGW.
Some versions of MinGW suffer from thread_local bugs.

PiperOrigin-RevId: 285022920

--
39a25493503c76885bc3254c28f66a251c5b5bb0 by Greg Falcon <gfalcon@google.com>:

Implementation detail change.

Add further ABSL_NAMESPACE_BEGIN and _END annotation macros to files in Abseil.

PiperOrigin-RevId: 285012012
GitOrigin-RevId: c99f979ad34f155fbeeea69b88bdc7458d89a21c
Change-Id: I4c85d3704e45d11a9ac50d562f39640a6adbedc1
This commit is contained in:
Abseil Team 2019-12-12 10:36:03 -08:00 committed by Matt Calabrese
parent 1e39f8626a
commit 12bc53e031
339 changed files with 948 additions and 82 deletions

View file

@ -28,6 +28,7 @@
#include "absl/strings/string_view.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace flags_internal {
// absl::Flag<T> represents a flag of type 'T' created by ABSL_FLAG.
@ -47,6 +48,7 @@ template <typename T>
using Flag = flags_internal::Flag<T>;
#endif
ABSL_NAMESPACE_END
} // namespace absl
// ABSL_DECLARE_FLAG()

View file

@ -18,6 +18,7 @@
#include <cstring>
namespace absl {
ABSL_NAMESPACE_BEGIN
// We want to validate the type mismatch between type definition and
// declaration. The lock-free implementation does not allow us to do it,
@ -55,4 +56,5 @@ absl::Mutex* GetGlobalConstructionGuard() { return &construction_guard; }
#endif
ABSL_NAMESPACE_END
} // namespace absl

View file

@ -38,6 +38,7 @@
#include "absl/flags/marshalling.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
// Flag
//
@ -219,6 +220,7 @@ void SetFlag(absl::Flag<T>* flag, const V& v) {
flag->Set(value);
}
ABSL_NAMESPACE_END
} // namespace absl

View file

@ -20,3 +20,5 @@
ABSL_FLAG(int, mistyped_int_flag, 0, "");
ABSL_FLAG(std::string, mistyped_string_flag, "", "");
ABSL_RETIRED_FLAG(bool, old_bool_flag, true,
"repetition of retired flag definition");

View file

@ -18,6 +18,7 @@
#include "absl/flags/usage_config.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace flags_internal {
// The help message indicating that the commandline flag has been
@ -57,4 +58,5 @@ std::string CommandLineFlag::Filename() const {
}
} // namespace flags_internal
ABSL_NAMESPACE_END
} // namespace absl

View file

@ -23,6 +23,7 @@
#include "absl/types/optional.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace flags_internal {
// Type-specific operations, eg., parsing, copying, etc. are provided
@ -158,7 +159,7 @@ class CommandLineFlag {
: name_(name), filename_(filename) {}
// Virtual destructor
virtual void Destroy() const = 0;
virtual void Destroy() = 0;
// Not copyable/assignable.
CommandLineFlag(const CommandLineFlag&) = delete;
@ -280,6 +281,7 @@ class CommandLineFlag {
A(float)
} // namespace flags_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_FLAGS_INTERNAL_COMMANDLINEFLAG_H_

View file

@ -19,6 +19,7 @@
#include "absl/synchronization/mutex.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace flags_internal {
namespace {
@ -34,20 +35,40 @@ bool ShouldValidateFlagValue(const CommandLineFlag& flag) {
return true;
}
// RAII helper used to temporarily unlock and relock `absl::Mutex`.
// This is used when we need to ensure that locks are released while
// invoking user supplied callbacks and then reacquired, since callbacks may
// need to acquire these locks themselves.
class MutexRelock {
public:
explicit MutexRelock(absl::Mutex* mu) : mu_(mu) { mu_->Unlock(); }
~MutexRelock() { mu_->Lock(); }
MutexRelock(const MutexRelock&) = delete;
MutexRelock& operator=(const MutexRelock&) = delete;
private:
absl::Mutex* mu_;
};
// This global lock guards the initialization and destruction of data_guard_,
// which is used to guard the other Flag data.
ABSL_CONST_INIT static absl::Mutex flag_mutex_lifetime_guard(absl::kConstInit);
} // namespace
void FlagImpl::Init() {
ABSL_CONST_INIT static absl::Mutex init_lock(absl::kConstInit);
{
absl::MutexLock lock(&init_lock);
absl::MutexLock lock(&flag_mutex_lifetime_guard);
if (locks_ == nullptr) { // Must initialize Mutexes for this flag.
locks_ = new FlagImpl::CommandLineFlagLocks;
// Must initialize data guard for this flag.
if (!is_data_guard_inited_) {
new (&data_guard_) absl::Mutex;
is_data_guard_inited_ = true;
}
}
absl::MutexLock lock(&locks_->primary_mu);
absl::MutexLock lock(reinterpret_cast<absl::Mutex*>(&data_guard_));
if (cur_ != nullptr) {
inited_.store(true, std::memory_order_release);
@ -67,21 +88,29 @@ absl::Mutex* FlagImpl::DataGuard() const {
const_cast<FlagImpl*>(this)->Init();
}
// All fields initialized; locks_ is therefore safe to read.
return &locks_->primary_mu;
// data_guard_ is initialized.
return reinterpret_cast<absl::Mutex*>(&data_guard_);
}
void FlagImpl::Destroy() const {
void FlagImpl::Destroy() {
{
absl::MutexLock l(DataGuard());
// Values are heap allocated for Abseil Flags.
if (cur_) Delete(op_, cur_);
if (def_kind_ == FlagDefaultSrcKind::kDynamicValue)
// Release the dynamically allocated default value if any.
if (def_kind_ == FlagDefaultSrcKind::kDynamicValue) {
Delete(op_, default_src_.dynamic_value);
}
// If this flag has an assigned callback, release callback data.
if (callback_data_) delete callback_data_;
}
delete locks_;
absl::MutexLock l(&flag_mutex_lifetime_guard);
DataGuard()->~Mutex();
is_data_guard_inited_ = false;
}
std::unique_ptr<void, DynValueDeleter> FlagImpl::MakeInitValue() const {
@ -126,13 +155,20 @@ void FlagImpl::SetCallback(
const flags_internal::FlagCallback mutation_callback) {
absl::MutexLock l(DataGuard());
callback_ = mutation_callback;
if (callback_data_ == nullptr) {
callback_data_ = new CallbackData;
}
callback_data_->func = mutation_callback;
InvokeCallback();
}
void FlagImpl::InvokeCallback() const {
if (!callback_) return;
if (!callback_data_) return;
// Make a copy of the C-style function pointer that we are about to invoke
// before we release the lock guarding it.
FlagCallback cb = callback_data_->func;
// If the flag has a mutation callback this function invokes it. While the
// callback is being invoked the primary flag's mutex is unlocked and it is
@ -145,14 +181,9 @@ void FlagImpl::InvokeCallback() const {
// and it also can be different by the time the callback invocation is
// completed. Requires that *primary_lock be held in exclusive mode; it may be
// released and reacquired by the implementation.
DataGuard()->Unlock();
{
absl::MutexLock lock(&locks_->callback_mu);
callback_();
}
DataGuard()->Lock();
MutexRelock relock(DataGuard());
absl::MutexLock lock(&callback_data_->guard);
cb();
}
bool FlagImpl::RestoreState(const CommandLineFlag& flag, const void* value,
@ -177,12 +208,13 @@ bool FlagImpl::RestoreState(const CommandLineFlag& flag, const void* value,
}
// Attempts to parse supplied `value` string using parsing routine in the `flag`
// argument. If parsing successful, this function stores the parsed value in
// 'dst' assuming it is a pointer to the flag's value type. In case if any error
// is encountered in either step, the error message is stored in 'err'
bool FlagImpl::TryParse(const CommandLineFlag& flag, void* dst,
// argument. If parsing successful, this function replaces the dst with newly
// parsed value. In case if any error is encountered in either step, the error
// message is stored in 'err'
bool FlagImpl::TryParse(const CommandLineFlag& flag, void** dst,
absl::string_view value, std::string* err) const {
auto tentative_value = MakeInitValue();
std::string parse_err;
if (!Parse(marshalling_op_, value, tentative_value.get(), &parse_err)) {
auto type_name = flag.Typename();
@ -194,7 +226,10 @@ bool FlagImpl::TryParse(const CommandLineFlag& flag, void* dst,
return false;
}
Copy(op_, tentative_value.get(), dst);
void* old_val = *dst;
*dst = tentative_value.release();
tentative_value.reset(old_val);
return true;
}
@ -274,7 +309,7 @@ bool FlagImpl::SetFromString(const CommandLineFlag& flag,
switch (set_mode) {
case SET_FLAGS_VALUE: {
// set or modify the flag's value
if (!TryParse(flag, cur_, value, err)) return false;
if (!TryParse(flag, &cur_, value, err)) return false;
modified_ = true;
counter_++;
StoreAtomic();
@ -288,7 +323,7 @@ bool FlagImpl::SetFromString(const CommandLineFlag& flag,
case SET_FLAG_IF_DEFAULT: {
// set the flag's value, but only if it hasn't been set by someone else
if (!modified_) {
if (!TryParse(flag, cur_, value, err)) return false;
if (!TryParse(flag, &cur_, value, err)) return false;
modified_ = true;
counter_++;
StoreAtomic();
@ -305,18 +340,19 @@ bool FlagImpl::SetFromString(const CommandLineFlag& flag,
break;
}
case SET_FLAGS_DEFAULT: {
// Flag's new default-value.
auto new_default_value = MakeInitValue();
if (!TryParse(flag, new_default_value.get(), value, err)) return false;
if (def_kind_ == FlagDefaultSrcKind::kDynamicValue) {
// Release old default value.
Delete(op_, default_src_.dynamic_value);
}
if (!TryParse(flag, &default_src_.dynamic_value, value, err)) {
return false;
}
} else {
void* new_default_val = nullptr;
if (!TryParse(flag, &new_default_val, value, err)) {
return false;
}
default_src_.dynamic_value = new_default_value.release();
def_kind_ = FlagDefaultSrcKind::kDynamicValue;
default_src_.dynamic_value = new_default_val;
def_kind_ = FlagDefaultSrcKind::kDynamicValue;
}
if (!modified_) {
// Need to set both default value *and* current, in this case
@ -361,4 +397,5 @@ bool FlagImpl::ValidateInputValue(absl::string_view value) const {
}
} // namespace flags_internal
ABSL_NAMESPACE_END
} // namespace absl

View file

@ -27,6 +27,7 @@
#include "absl/synchronization/mutex.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace flags_internal {
constexpr int64_t AtomicInit() { return 0xababababababababll; }
@ -156,10 +157,11 @@ class FlagImpl {
help_(help.source),
help_source_kind_(help.kind),
def_kind_(flags_internal::FlagDefaultSrcKind::kGenFunc),
default_src_(default_value_gen) {}
default_src_(default_value_gen),
data_guard_{} {}
// Forces destruction of the Flag's data.
void Destroy() const;
void Destroy();
// Constant access methods
std::string Help() const;
@ -170,9 +172,10 @@ class FlagImpl {
void Read(const CommandLineFlag& flag, void* dst,
const flags_internal::FlagOpFn dst_op) const
ABSL_LOCKS_EXCLUDED(*DataGuard());
// Attempts to parse supplied `value` std::string.
bool TryParse(const CommandLineFlag& flag, void* dst, absl::string_view value,
std::string* err) const
// Attempts to parse supplied `value` std::string. If parsing is successful, then
// it replaces `dst` with the new value.
bool TryParse(const CommandLineFlag& flag, void** dst,
absl::string_view value, std::string* err) const
ABSL_EXCLUSIVE_LOCKS_REQUIRED(*DataGuard());
template <typename T>
bool AtomicGet(T* v) const {
@ -226,8 +229,7 @@ class FlagImpl {
void Init();
// Ensures that the lazily initialized data is initialized,
// and returns pointer to the mutex guarding flags data.
absl::Mutex* DataGuard() const ABSL_LOCK_RETURNED(locks_->primary_mu);
absl::Mutex* DataGuard() const ABSL_LOCK_RETURNED((absl::Mutex*)&data_guard_);
// Returns heap allocated value of type T initialized with default value.
std::unique_ptr<void, DynValueDeleter> MakeInitValue() const
ABSL_EXCLUSIVE_LOCKS_REQUIRED(*DataGuard());
@ -239,9 +241,12 @@ class FlagImpl {
// Indicates if help message was supplied as literal or generator func.
const FlagHelpSrcKind help_source_kind_;
// Mutable Flag's data. (guarded by DataGuard()).
// Indicates that locks_ and cur_ fields have been lazily initialized.
// Indicates that the Flag state is initialized.
std::atomic<bool> inited_{false};
// Mutable Flag state (guarded by data_guard_).
// Additional bool to protect against multiple concurrent constructions
// of `data_guard_`.
bool is_data_guard_inited_ = false;
// Has flag value been modified?
bool modified_ ABSL_GUARDED_BY(*DataGuard()) = false;
// Specified on command line.
@ -261,22 +266,20 @@ class FlagImpl {
// For some types, a copy of the current value is kept in an atomically
// accessible field.
std::atomic<int64_t> atomic_{flags_internal::AtomicInit()};
// Mutation callback
FlagCallback callback_ = nullptr;
// Lazily initialized mutexes for this flag value. We cannot inline a
// SpinLock or Mutex here because those have non-constexpr constructors and
// so would prevent constant initialization of this type.
// TODO(rogeeff): fix it once Mutex has constexpr constructor
// The following struct contains the locks in a CommandLineFlag struct.
// They are in a separate struct that is lazily allocated to avoid problems
// with static initialization and to avoid multiple allocations.
struct CommandLineFlagLocks {
absl::Mutex primary_mu; // protects several fields in CommandLineFlag
absl::Mutex callback_mu; // used to serialize callbacks
struct CallbackData {
FlagCallback func;
absl::Mutex guard; // Guard for concurrent callback invocations.
};
CommandLineFlagLocks* locks_ = nullptr; // locks, laziliy allocated.
CallbackData* callback_data_ ABSL_GUARDED_BY(*DataGuard()) = nullptr;
// This is reserved space for an absl::Mutex to guard flag data. It will be
// initialized in FlagImpl::Init via placement new.
// We can't use "absl::Mutex data_guard_", since this class is not literal.
// We do not want to use "absl::Mutex* data_guard_", since this would require
// heap allocation during initialization, which is both slows program startup
// and can fail. Using reserved space + placement new allows us to avoid both
// problems.
alignas(absl::Mutex) mutable char data_guard_[sizeof(absl::Mutex)];
};
// This is "unspecified" implementation of absl::Flag<T> type.
@ -354,7 +357,7 @@ class Flag final : public flags_internal::CommandLineFlag {
private:
friend class FlagState<T>;
void Destroy() const override { impl_.Destroy(); }
void Destroy() override { impl_.Destroy(); }
void Read(void* dst) const override {
impl_.Read(*this, dst, &flags_internal::FlagOps<T>);
@ -414,6 +417,7 @@ T* MakeFromDefaultValue(EmptyBraces) {
}
} // namespace flags_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_FLAGS_INTERNAL_FLAG_H_

View file

@ -27,6 +27,7 @@ ABSL_DECLARE_FLAG(std::vector<std::string>, tryfromenv);
ABSL_DECLARE_FLAG(std::vector<std::string>, undefok);
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace flags_internal {
enum class ArgvListAction { kRemoveParsedArgs, kKeepParsedArgs };
@ -43,6 +44,7 @@ std::vector<char*> ParseCommandLineImpl(int argc, char* argv[],
OnUndefinedFlag on_undef_flag);
} // namespace flags_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_FLAGS_INTERNAL_PARSE_H_

View file

@ -20,6 +20,7 @@
#include "absl/strings/string_view.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace flags_internal {
// A portable interface that returns the basename of the filename passed as an
@ -55,6 +56,7 @@ inline absl::string_view Package(absl::string_view filename) {
}
} // namespace flags_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_FLAGS_INTERNAL_PATH_UTIL_H_

View file

@ -21,6 +21,7 @@
#include "absl/synchronization/mutex.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace flags_internal {
ABSL_CONST_INIT static absl::Mutex program_name_guard(absl::kConstInit);
@ -50,4 +51,5 @@ void SetProgramInvocationName(absl::string_view prog_name_str) {
}
} // namespace flags_internal
ABSL_NAMESPACE_END
} // namespace absl

View file

@ -24,6 +24,7 @@
// Program name
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace flags_internal {
// Returns program invocation name or "UNKNOWN" if `SetProgramInvocationName()`
@ -42,6 +43,7 @@ std::string ShortProgramInvocationName();
void SetProgramInvocationName(absl::string_view prog_name_str);
} // namespace flags_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_FLAGS_INTERNAL_PROGRAM_NAME_H_

View file

@ -30,6 +30,7 @@
// set it.
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace flags_internal {
// --------------------------------------------------------------------
@ -281,7 +282,7 @@ class RetiredFlagObj final : public flags_internal::CommandLineFlag {
op_(ops) {}
private:
void Destroy() const override {
void Destroy() override {
// Values are heap allocated for Retired Flags.
delete this;
}
@ -336,4 +337,5 @@ bool IsRetiredFlag(absl::string_view name, bool* type_is_bool) {
}
} // namespace flags_internal
ABSL_NAMESPACE_END
} // namespace absl

View file

@ -27,6 +27,7 @@
// Global flags registry API.
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace flags_internal {
CommandLineFlag* FindCommandLineFlag(absl::string_view name);
@ -115,6 +116,7 @@ class FlagSaver {
};
} // namespace flags_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_FLAGS_INTERNAL_REGISTRY_H_

View file

@ -21,6 +21,7 @@
#include "absl/strings/str_cat.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace flags_internal {
bool GetCommandLineOption(absl::string_view name, std::string* value) {
@ -79,4 +80,5 @@ bool SpecifiedOnCommandLine(absl::string_view name) {
}
} // namespace flags_internal
ABSL_NAMESPACE_END
} // namespace absl

View file

@ -25,6 +25,7 @@
// Registry interfaces operating on type erased handles.
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace flags_internal {
// If a flag named "name" exists, store its current value in *OUTPUT
@ -81,6 +82,7 @@ inline bool GetByName(absl::string_view name, T* dst) {
}
} // namespace flags_internal
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_FLAGS_INTERNAL_TYPE_ERASED_H_

View file

@ -44,6 +44,7 @@ ABSL_FLAG(std::string, helpmatch, "",
"show help on modules whose name contains the specified substr");
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace flags_internal {
namespace {
@ -404,4 +405,5 @@ int HandleUsageFlags(std::ostream& out,
}
} // namespace flags_internal
ABSL_NAMESPACE_END
} // namespace absl

View file

@ -27,6 +27,7 @@
// Usage reporting interfaces
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace flags_internal {
// The format to report the help messages in.
@ -64,6 +65,7 @@ int HandleUsageFlags(std::ostream& out,
absl::string_view program_usage_message);
} // namespace flags_internal
ABSL_NAMESPACE_END
} // namespace absl
ABSL_DECLARE_FLAG(bool, help);

View file

@ -27,6 +27,7 @@
#include "absl/strings/str_split.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace flags_internal {
// --------------------------------------------------------------------
@ -226,4 +227,5 @@ std::string AbslUnparseFlag(absl::LogSeverity v) {
return absl::UnparseFlag(static_cast<int>(v));
}
ABSL_NAMESPACE_END
} // namespace absl

View file

@ -168,6 +168,7 @@
#include "absl/strings/string_view.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace flags_internal {
// Overloads of `AbslParseFlag()` and `AbslUnparseFlag()` for fundamental types.
@ -256,6 +257,7 @@ enum class LogSeverity : int;
bool AbslParseFlag(absl::string_view, absl::LogSeverity*, std::string*);
std::string AbslUnparseFlag(absl::LogSeverity);
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_FLAGS_MARSHALLING_H_

View file

@ -38,6 +38,7 @@
// --------------------------------------------------------------------
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace flags_internal {
namespace {
@ -52,6 +53,7 @@ ABSL_CONST_INIT bool tryfromenv_needs_processing
} // namespace
} // namespace flags_internal
ABSL_NAMESPACE_END
} // namespace absl
ABSL_FLAG(std::vector<std::string>, flagfile, {},
@ -109,6 +111,7 @@ ABSL_FLAG(std::vector<std::string>, undefok, {},
"with that name");
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace flags_internal {
namespace {
@ -748,4 +751,5 @@ std::vector<char*> ParseCommandLine(int argc, char* argv[]) {
flags_internal::OnUndefinedFlag::kAbortIfUndefined);
}
ABSL_NAMESPACE_END
} // namespace absl

View file

@ -29,6 +29,7 @@
#include "absl/flags/internal/parse.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
// ParseCommandLine()
//
@ -53,6 +54,7 @@ namespace absl {
// help messages and then exits the program.
std::vector<char*> ParseCommandLine(int argc, char* argv[]);
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_FLAGS_PARSE_H_

View file

@ -20,6 +20,7 @@
#include "absl/synchronization/mutex.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace flags_internal {
namespace {
ABSL_CONST_INIT absl::Mutex usage_message_guard(absl::kConstInit);
@ -53,4 +54,5 @@ absl::string_view ProgramUsageMessage() {
: "Warning: SetProgramUsageMessage() never called";
}
ABSL_NAMESPACE_END
} // namespace absl

View file

@ -22,6 +22,7 @@
// Usage reporting interfaces
namespace absl {
ABSL_NAMESPACE_BEGIN
// Sets the "usage" message to be used by help reporting routines.
// For example:
@ -35,6 +36,7 @@ void SetProgramUsageMessage(absl::string_view new_usage_message);
// Returns the usage message set by SetProgramUsageMessage().
absl::string_view ProgramUsageMessage();
ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_FLAGS_USAGE_H_

View file

@ -34,6 +34,7 @@ ABSL_ATTRIBUTE_WEAK void AbslInternalReportFatalUsageError(absl::string_view) {}
} // extern "C"
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace flags_internal {
namespace {
@ -149,4 +150,5 @@ void SetFlagsUsageConfig(FlagsUsageConfig usage_config) {
flags_internal::custom_usage_config = new FlagsUsageConfig(usage_config);
}
ABSL_NAMESPACE_END
} // namespace absl

View file

@ -54,6 +54,7 @@
// Shows help on modules whose name contains the specified substring
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace flags_internal {
using FlagKindFilter = std::function<bool (absl::string_view)>;
@ -118,6 +119,7 @@ FlagsUsageConfig GetUsageConfig();
void ReportUsageError(absl::string_view msg, bool is_fatal);
} // namespace flags_internal
ABSL_NAMESPACE_END
} // namespace absl
extern "C" {