aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/restricted/abseil-cpp/absl/flags/internal
diff options
context:
space:
mode:
authorayles <ayles@yandex-team.ru>2022-02-10 16:46:11 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:11 +0300
commitd55028e9d9708f94c2d0d35b54ed50d4d7af0456 (patch)
treed69fdff3b2be7d190a1efa078721d25139d0b030 /contrib/restricted/abseil-cpp/absl/flags/internal
parentbaa58daefa91fde4b4769facdbd2903763b9c6a8 (diff)
downloadydb-d55028e9d9708f94c2d0d35b54ed50d4d7af0456.tar.gz
Restoring authorship annotation for <ayles@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/restricted/abseil-cpp/absl/flags/internal')
-rw-r--r--contrib/restricted/abseil-cpp/absl/flags/internal/commandlineflag.cc8
-rw-r--r--contrib/restricted/abseil-cpp/absl/flags/internal/commandlineflag.h22
-rw-r--r--contrib/restricted/abseil-cpp/absl/flags/internal/commandlineflag/ya.make8
-rw-r--r--contrib/restricted/abseil-cpp/absl/flags/internal/flag.cc656
-rw-r--r--contrib/restricted/abseil-cpp/absl/flags/internal/flag.h1156
-rw-r--r--contrib/restricted/abseil-cpp/absl/flags/internal/parse.h22
-rw-r--r--contrib/restricted/abseil-cpp/absl/flags/internal/path_util.h6
-rw-r--r--contrib/restricted/abseil-cpp/absl/flags/internal/private_handle_accessor.cc130
-rw-r--r--contrib/restricted/abseil-cpp/absl/flags/internal/private_handle_accessor.h122
-rw-r--r--contrib/restricted/abseil-cpp/absl/flags/internal/private_handle_accessor/ya.make8
-rw-r--r--contrib/restricted/abseil-cpp/absl/flags/internal/program_name.cc14
-rw-r--r--contrib/restricted/abseil-cpp/absl/flags/internal/program_name.h6
-rw-r--r--contrib/restricted/abseil-cpp/absl/flags/internal/program_name/ya.make8
-rw-r--r--contrib/restricted/abseil-cpp/absl/flags/internal/registry.h34
-rw-r--r--contrib/restricted/abseil-cpp/absl/flags/internal/usage.cc74
-rw-r--r--contrib/restricted/abseil-cpp/absl/flags/internal/usage.h14
-rw-r--r--contrib/restricted/abseil-cpp/absl/flags/internal/usage/ya.make72
17 files changed, 1180 insertions, 1180 deletions
diff --git a/contrib/restricted/abseil-cpp/absl/flags/internal/commandlineflag.cc b/contrib/restricted/abseil-cpp/absl/flags/internal/commandlineflag.cc
index 4482955c4c..3c32c17d0b 100644
--- a/contrib/restricted/abseil-cpp/absl/flags/internal/commandlineflag.cc
+++ b/contrib/restricted/abseil-cpp/absl/flags/internal/commandlineflag.cc
@@ -1,5 +1,5 @@
//
-// Copyright 2020 The Abseil Authors.
+// Copyright 2020 The Abseil Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -16,11 +16,11 @@
#include "absl/flags/internal/commandlineflag.h"
namespace absl {
-ABSL_NAMESPACE_BEGIN
+ABSL_NAMESPACE_BEGIN
namespace flags_internal {
-FlagStateInterface::~FlagStateInterface() {}
+FlagStateInterface::~FlagStateInterface() {}
} // namespace flags_internal
-ABSL_NAMESPACE_END
+ABSL_NAMESPACE_END
} // namespace absl
diff --git a/contrib/restricted/abseil-cpp/absl/flags/internal/commandlineflag.h b/contrib/restricted/abseil-cpp/absl/flags/internal/commandlineflag.h
index ebfe81ba1e..a97117b6d5 100644
--- a/contrib/restricted/abseil-cpp/absl/flags/internal/commandlineflag.h
+++ b/contrib/restricted/abseil-cpp/absl/flags/internal/commandlineflag.h
@@ -16,19 +16,19 @@
#ifndef ABSL_FLAGS_INTERNAL_COMMANDLINEFLAG_H_
#define ABSL_FLAGS_INTERNAL_COMMANDLINEFLAG_H_
-#include "absl/base/config.h"
-#include "absl/base/internal/fast_type_id.h"
+#include "absl/base/config.h"
+#include "absl/base/internal/fast_type_id.h"
namespace absl {
-ABSL_NAMESPACE_BEGIN
+ABSL_NAMESPACE_BEGIN
namespace flags_internal {
-// An alias for flag fast type id. This value identifies the flag value type
+// An alias for flag fast type id. This value identifies the flag value type
// similarly to typeid(T), without relying on RTTI being available. In most
-// cases this id is enough to uniquely identify the flag's value type. In a few
-// cases we'll have to resort to using actual RTTI implementation if it is
-// available.
-using FlagFastTypeId = absl::base_internal::FastTypeIdType;
+// cases this id is enough to uniquely identify the flag's value type. In a few
+// cases we'll have to resort to using actual RTTI implementation if it is
+// available.
+using FlagFastTypeId = absl::base_internal::FastTypeIdType;
// Options that control SetCommandLineOptionWithMode.
enum FlagSettingMode {
@@ -43,7 +43,7 @@ enum FlagSettingMode {
SET_FLAGS_DEFAULT
};
-// Options that control ParseFrom: Source of a value.
+// Options that control ParseFrom: Source of a value.
enum ValueSource {
// Flag is being set by value specified on a command line.
kCommandLine,
@@ -55,14 +55,14 @@ enum ValueSource {
// of a flag produced this flag state from method CommandLineFlag::SaveState().
class FlagStateInterface {
public:
- virtual ~FlagStateInterface();
+ virtual ~FlagStateInterface();
// Restores the flag originated this object to the saved state.
virtual void Restore() const = 0;
};
} // namespace flags_internal
-ABSL_NAMESPACE_END
+ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_FLAGS_INTERNAL_COMMANDLINEFLAG_H_
diff --git a/contrib/restricted/abseil-cpp/absl/flags/internal/commandlineflag/ya.make b/contrib/restricted/abseil-cpp/absl/flags/internal/commandlineflag/ya.make
index e5a0389d4d..6dde2c9c9c 100644
--- a/contrib/restricted/abseil-cpp/absl/flags/internal/commandlineflag/ya.make
+++ b/contrib/restricted/abseil-cpp/absl/flags/internal/commandlineflag/ya.make
@@ -16,10 +16,10 @@ NO_COMPILER_WARNINGS()
NO_UTIL()
-CFLAGS(
- -DNOMINMAX
-)
-
+CFLAGS(
+ -DNOMINMAX
+)
+
SRCDIR(contrib/restricted/abseil-cpp/absl/flags/internal)
SRCS(
diff --git a/contrib/restricted/abseil-cpp/absl/flags/internal/flag.cc b/contrib/restricted/abseil-cpp/absl/flags/internal/flag.cc
index 1515022d11..e6c1f96e8e 100644
--- a/contrib/restricted/abseil-cpp/absl/flags/internal/flag.cc
+++ b/contrib/restricted/abseil-cpp/absl/flags/internal/flag.cc
@@ -15,162 +15,162 @@
#include "absl/flags/internal/flag.h"
-#include <assert.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <string.h>
-
-#include <array>
-#include <atomic>
-#include <memory>
-#include <new>
-#include <string>
-#include <typeinfo>
-
-#include "absl/base/call_once.h"
-#include "absl/base/casts.h"
-#include "absl/base/config.h"
+#include <assert.h>
+#include <stddef.h>
+#include <stdint.h>
+#include <string.h>
+
+#include <array>
+#include <atomic>
+#include <memory>
+#include <new>
+#include <string>
+#include <typeinfo>
+
+#include "absl/base/call_once.h"
+#include "absl/base/casts.h"
+#include "absl/base/config.h"
#include "absl/base/optimization.h"
-#include "absl/flags/config.h"
-#include "absl/flags/internal/commandlineflag.h"
-#include "absl/flags/usage_config.h"
-#include "absl/memory/memory.h"
-#include "absl/strings/str_cat.h"
-#include "absl/strings/string_view.h"
+#include "absl/flags/config.h"
+#include "absl/flags/internal/commandlineflag.h"
+#include "absl/flags/usage_config.h"
+#include "absl/memory/memory.h"
+#include "absl/strings/str_cat.h"
+#include "absl/strings/string_view.h"
#include "absl/synchronization/mutex.h"
namespace absl {
-ABSL_NAMESPACE_BEGIN
+ABSL_NAMESPACE_BEGIN
namespace flags_internal {
-
-// The help message indicating that the commandline flag has been
-// 'stripped'. It will not show up when doing "-help" and its
-// variants. The flag is stripped if ABSL_FLAGS_STRIP_HELP is set to 1
-// before including absl/flags/flag.h
-const char kStrippedFlagHelp[] = "\001\002\003\004 (unknown) \004\003\002\001";
-
+
+// The help message indicating that the commandline flag has been
+// 'stripped'. It will not show up when doing "-help" and its
+// variants. The flag is stripped if ABSL_FLAGS_STRIP_HELP is set to 1
+// before including absl/flags/flag.h
+const char kStrippedFlagHelp[] = "\001\002\003\004 (unknown) \004\003\002\001";
+
namespace {
// Currently we only validate flag values for user-defined flag types.
-bool ShouldValidateFlagValue(FlagFastTypeId flag_type_id) {
-#define DONT_VALIDATE(T, _) \
- if (flag_type_id == base_internal::FastTypeId<T>()) return false;
- ABSL_FLAGS_INTERNAL_SUPPORTED_TYPES(DONT_VALIDATE)
+bool ShouldValidateFlagValue(FlagFastTypeId flag_type_id) {
+#define DONT_VALIDATE(T, _) \
+ if (flag_type_id == base_internal::FastTypeId<T>()) return false;
+ ABSL_FLAGS_INTERNAL_SUPPORTED_TYPES(DONT_VALIDATE)
#undef DONT_VALIDATE
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_;
-};
-
+// 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_;
+};
+
} // namespace
-///////////////////////////////////////////////////////////////////////////////
-// Persistent state of the flag data.
-
-class FlagImpl;
-
-class FlagState : public flags_internal::FlagStateInterface {
- public:
- template <typename V>
- FlagState(FlagImpl& flag_impl, const V& v, bool modified,
- bool on_command_line, int64_t counter)
- : flag_impl_(flag_impl),
- value_(v),
- modified_(modified),
- on_command_line_(on_command_line),
- counter_(counter) {}
-
- ~FlagState() override {
+///////////////////////////////////////////////////////////////////////////////
+// Persistent state of the flag data.
+
+class FlagImpl;
+
+class FlagState : public flags_internal::FlagStateInterface {
+ public:
+ template <typename V>
+ FlagState(FlagImpl& flag_impl, const V& v, bool modified,
+ bool on_command_line, int64_t counter)
+ : flag_impl_(flag_impl),
+ value_(v),
+ modified_(modified),
+ on_command_line_(on_command_line),
+ counter_(counter) {}
+
+ ~FlagState() override {
if (flag_impl_.ValueStorageKind() != FlagValueStorageKind::kAlignedBuffer &&
flag_impl_.ValueStorageKind() != FlagValueStorageKind::kSequenceLocked)
- return;
- flags_internal::Delete(flag_impl_.op_, value_.heap_allocated);
+ return;
+ flags_internal::Delete(flag_impl_.op_, value_.heap_allocated);
}
- private:
- friend class FlagImpl;
-
- // Restores the flag to the saved state.
- void Restore() const override {
- if (!flag_impl_.RestoreState(*this)) return;
+ private:
+ friend class FlagImpl;
- ABSL_INTERNAL_LOG(INFO,
- absl::StrCat("Restore saved value of ", flag_impl_.Name(),
- " to: ", flag_impl_.CurrentValue()));
+ // Restores the flag to the saved state.
+ void Restore() const override {
+ if (!flag_impl_.RestoreState(*this)) return;
+
+ ABSL_INTERNAL_LOG(INFO,
+ absl::StrCat("Restore saved value of ", flag_impl_.Name(),
+ " to: ", flag_impl_.CurrentValue()));
}
-
- // Flag and saved flag data.
- FlagImpl& flag_impl_;
- union SavedValue {
- explicit SavedValue(void* v) : heap_allocated(v) {}
- explicit SavedValue(int64_t v) : one_word(v) {}
-
- void* heap_allocated;
- int64_t one_word;
- } value_;
- bool modified_;
- bool on_command_line_;
- int64_t counter_;
-};
-
-///////////////////////////////////////////////////////////////////////////////
-// Flag implementation, which does not depend on flag value type.
-
-DynValueDeleter::DynValueDeleter(FlagOpFn op_arg) : op(op_arg) {}
-
-void DynValueDeleter::operator()(void* ptr) const {
- if (op == nullptr) return;
-
- Delete(op, ptr);
+
+ // Flag and saved flag data.
+ FlagImpl& flag_impl_;
+ union SavedValue {
+ explicit SavedValue(void* v) : heap_allocated(v) {}
+ explicit SavedValue(int64_t v) : one_word(v) {}
+
+ void* heap_allocated;
+ int64_t one_word;
+ } value_;
+ bool modified_;
+ bool on_command_line_;
+ int64_t counter_;
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// Flag implementation, which does not depend on flag value type.
+
+DynValueDeleter::DynValueDeleter(FlagOpFn op_arg) : op(op_arg) {}
+
+void DynValueDeleter::operator()(void* ptr) const {
+ if (op == nullptr) return;
+
+ Delete(op, ptr);
}
-void FlagImpl::Init() {
- new (&data_guard_) absl::Mutex;
-
- auto def_kind = static_cast<FlagDefaultKind>(def_kind_);
-
- switch (ValueStorageKind()) {
+void FlagImpl::Init() {
+ new (&data_guard_) absl::Mutex;
+
+ auto def_kind = static_cast<FlagDefaultKind>(def_kind_);
+
+ switch (ValueStorageKind()) {
case FlagValueStorageKind::kValueAndInitBit:
- case FlagValueStorageKind::kOneWordAtomic: {
- alignas(int64_t) std::array<char, sizeof(int64_t)> buf{};
- if (def_kind == FlagDefaultKind::kGenFunc) {
- (*default_value_.gen_func)(buf.data());
- } else {
- assert(def_kind != FlagDefaultKind::kDynamicValue);
- std::memcpy(buf.data(), &default_value_, Sizeof(op_));
- }
+ case FlagValueStorageKind::kOneWordAtomic: {
+ alignas(int64_t) std::array<char, sizeof(int64_t)> buf{};
+ if (def_kind == FlagDefaultKind::kGenFunc) {
+ (*default_value_.gen_func)(buf.data());
+ } else {
+ assert(def_kind != FlagDefaultKind::kDynamicValue);
+ std::memcpy(buf.data(), &default_value_, Sizeof(op_));
+ }
if (ValueStorageKind() == FlagValueStorageKind::kValueAndInitBit) {
// We presume here the memory layout of FlagValueAndInitBit struct.
uint8_t initialized = 1;
std::memcpy(buf.data() + Sizeof(op_), &initialized,
sizeof(initialized));
}
- OneWordValue().store(absl::bit_cast<int64_t>(buf),
- std::memory_order_release);
- break;
- }
+ OneWordValue().store(absl::bit_cast<int64_t>(buf),
+ std::memory_order_release);
+ break;
+ }
case FlagValueStorageKind::kSequenceLocked: {
- // For this storage kind the default_value_ always points to gen_func
- // during initialization.
- assert(def_kind == FlagDefaultKind::kGenFunc);
+ // For this storage kind the default_value_ always points to gen_func
+ // during initialization.
+ assert(def_kind == FlagDefaultKind::kGenFunc);
(*default_value_.gen_func)(AtomicBufferValue());
- break;
- }
+ break;
+ }
case FlagValueStorageKind::kAlignedBuffer:
// For this storage kind the default_value_ always points to gen_func
// during initialization.
@@ -179,95 +179,95 @@ void FlagImpl::Init() {
break;
}
seq_lock_.MarkInitialized();
+}
+
+absl::Mutex* FlagImpl::DataGuard() const {
+ absl::call_once(const_cast<FlagImpl*>(this)->init_control_, &FlagImpl::Init,
+ const_cast<FlagImpl*>(this));
+
+ // data_guard_ is initialized inside Init.
+ return reinterpret_cast<absl::Mutex*>(&data_guard_);
}
-absl::Mutex* FlagImpl::DataGuard() const {
- absl::call_once(const_cast<FlagImpl*>(this)->init_control_, &FlagImpl::Init,
- const_cast<FlagImpl*>(this));
-
- // data_guard_ is initialized inside Init.
- return reinterpret_cast<absl::Mutex*>(&data_guard_);
-}
-
-void FlagImpl::AssertValidType(FlagFastTypeId rhs_type_id,
- const std::type_info* (*gen_rtti)()) const {
- FlagFastTypeId lhs_type_id = flags_internal::FastTypeId(op_);
-
- // `rhs_type_id` is the fast type id corresponding to the declaration
- // visibile at the call site. `lhs_type_id` is the fast type id
- // corresponding to the type specified in flag definition. They must match
- // for this operation to be well-defined.
- if (ABSL_PREDICT_TRUE(lhs_type_id == rhs_type_id)) return;
-
- const std::type_info* lhs_runtime_type_id =
- flags_internal::RuntimeTypeId(op_);
- const std::type_info* rhs_runtime_type_id = (*gen_rtti)();
-
- if (lhs_runtime_type_id == rhs_runtime_type_id) return;
-
-#if defined(ABSL_FLAGS_INTERNAL_HAS_RTTI)
- if (*lhs_runtime_type_id == *rhs_runtime_type_id) return;
-#endif
-
- ABSL_INTERNAL_LOG(
- FATAL, absl::StrCat("Flag '", Name(),
- "' is defined as one type and declared as another"));
-}
-
-std::unique_ptr<void, DynValueDeleter> FlagImpl::MakeInitValue() const {
- void* res = nullptr;
- switch (DefaultKind()) {
- case FlagDefaultKind::kDynamicValue:
- res = flags_internal::Clone(op_, default_value_.dynamic_value);
- break;
- case FlagDefaultKind::kGenFunc:
- res = flags_internal::Alloc(op_);
- (*default_value_.gen_func)(res);
- break;
- default:
- res = flags_internal::Clone(op_, &default_value_);
- break;
+void FlagImpl::AssertValidType(FlagFastTypeId rhs_type_id,
+ const std::type_info* (*gen_rtti)()) const {
+ FlagFastTypeId lhs_type_id = flags_internal::FastTypeId(op_);
+
+ // `rhs_type_id` is the fast type id corresponding to the declaration
+ // visibile at the call site. `lhs_type_id` is the fast type id
+ // corresponding to the type specified in flag definition. They must match
+ // for this operation to be well-defined.
+ if (ABSL_PREDICT_TRUE(lhs_type_id == rhs_type_id)) return;
+
+ const std::type_info* lhs_runtime_type_id =
+ flags_internal::RuntimeTypeId(op_);
+ const std::type_info* rhs_runtime_type_id = (*gen_rtti)();
+
+ if (lhs_runtime_type_id == rhs_runtime_type_id) return;
+
+#if defined(ABSL_FLAGS_INTERNAL_HAS_RTTI)
+ if (*lhs_runtime_type_id == *rhs_runtime_type_id) return;
+#endif
+
+ ABSL_INTERNAL_LOG(
+ FATAL, absl::StrCat("Flag '", Name(),
+ "' is defined as one type and declared as another"));
+}
+
+std::unique_ptr<void, DynValueDeleter> FlagImpl::MakeInitValue() const {
+ void* res = nullptr;
+ switch (DefaultKind()) {
+ case FlagDefaultKind::kDynamicValue:
+ res = flags_internal::Clone(op_, default_value_.dynamic_value);
+ break;
+ case FlagDefaultKind::kGenFunc:
+ res = flags_internal::Alloc(op_);
+ (*default_value_.gen_func)(res);
+ break;
+ default:
+ res = flags_internal::Clone(op_, &default_value_);
+ break;
}
- return {res, DynValueDeleter{op_}};
-}
+ return {res, DynValueDeleter{op_}};
+}
-void FlagImpl::StoreValue(const void* src) {
- switch (ValueStorageKind()) {
+void FlagImpl::StoreValue(const void* src) {
+ switch (ValueStorageKind()) {
case FlagValueStorageKind::kValueAndInitBit:
- case FlagValueStorageKind::kOneWordAtomic: {
+ case FlagValueStorageKind::kOneWordAtomic: {
// Load the current value to avoid setting 'init' bit manualy.
int64_t one_word_val = OneWordValue().load(std::memory_order_acquire);
- std::memcpy(&one_word_val, src, Sizeof(op_));
- OneWordValue().store(one_word_val, std::memory_order_release);
+ std::memcpy(&one_word_val, src, Sizeof(op_));
+ OneWordValue().store(one_word_val, std::memory_order_release);
seq_lock_.IncrementModificationCount();
- break;
- }
+ break;
+ }
case FlagValueStorageKind::kSequenceLocked: {
seq_lock_.Write(AtomicBufferValue(), src, Sizeof(op_));
- break;
- }
+ break;
+ }
case FlagValueStorageKind::kAlignedBuffer:
Copy(op_, src, AlignedBufferValue());
seq_lock_.IncrementModificationCount();
break;
- }
- modified_ = true;
- InvokeCallback();
-}
-
-absl::string_view FlagImpl::Name() const { return name_; }
-
-std::string FlagImpl::Filename() const {
- return flags_internal::GetUsageConfig().normalize_filename(filename_);
+ }
+ modified_ = true;
+ InvokeCallback();
}
+absl::string_view FlagImpl::Name() const { return name_; }
+
+std::string FlagImpl::Filename() const {
+ return flags_internal::GetUsageConfig().normalize_filename(filename_);
+}
+
std::string FlagImpl::Help() const {
- return HelpSourceKind() == FlagHelpKind::kLiteral ? help_.literal
- : help_.gen_func();
+ return HelpSourceKind() == FlagHelpKind::kLiteral ? help_.literal
+ : help_.gen_func();
}
-FlagFastTypeId FlagImpl::TypeId() const {
- return flags_internal::FastTypeId(op_);
+FlagFastTypeId FlagImpl::TypeId() const {
+ return flags_internal::FastTypeId(op_);
}
int64_t FlagImpl::ModificationCount() const {
@@ -282,53 +282,53 @@ bool FlagImpl::IsSpecifiedOnCommandLine() const {
std::string FlagImpl::DefaultValue() const {
absl::MutexLock l(DataGuard());
- auto obj = MakeInitValue();
- return flags_internal::Unparse(op_, obj.get());
+ auto obj = MakeInitValue();
+ return flags_internal::Unparse(op_, obj.get());
}
std::string FlagImpl::CurrentValue() const {
- auto* guard = DataGuard(); // Make sure flag initialized
- switch (ValueStorageKind()) {
+ auto* guard = DataGuard(); // Make sure flag initialized
+ switch (ValueStorageKind()) {
case FlagValueStorageKind::kValueAndInitBit:
- case FlagValueStorageKind::kOneWordAtomic: {
- const auto one_word_val =
- absl::bit_cast<std::array<char, sizeof(int64_t)>>(
- OneWordValue().load(std::memory_order_acquire));
- return flags_internal::Unparse(op_, one_word_val.data());
- }
+ case FlagValueStorageKind::kOneWordAtomic: {
+ const auto one_word_val =
+ absl::bit_cast<std::array<char, sizeof(int64_t)>>(
+ OneWordValue().load(std::memory_order_acquire));
+ return flags_internal::Unparse(op_, one_word_val.data());
+ }
case FlagValueStorageKind::kSequenceLocked: {
std::unique_ptr<void, DynValueDeleter> cloned(flags_internal::Alloc(op_),
DynValueDeleter{op_});
ReadSequenceLockedData(cloned.get());
return flags_internal::Unparse(op_, cloned.get());
- }
+ }
case FlagValueStorageKind::kAlignedBuffer: {
absl::MutexLock l(guard);
return flags_internal::Unparse(op_, AlignedBufferValue());
}
- }
+ }
- return "";
+ return "";
}
-void FlagImpl::SetCallback(const FlagCallbackFunc mutation_callback) {
+void FlagImpl::SetCallback(const FlagCallbackFunc mutation_callback) {
absl::MutexLock l(DataGuard());
- if (callback_ == nullptr) {
- callback_ = new FlagCallback;
- }
- callback_->func = mutation_callback;
+ if (callback_ == nullptr) {
+ callback_ = new FlagCallback;
+ }
+ callback_->func = mutation_callback;
InvokeCallback();
}
-void FlagImpl::InvokeCallback() const {
+void FlagImpl::InvokeCallback() const {
if (!callback_) return;
- // Make a copy of the C-style function pointer that we are about to invoke
- // before we release the lock guarding it.
- FlagCallbackFunc cb = callback_->func;
-
+ // Make a copy of the C-style function pointer that we are about to invoke
+ // before we release the lock guarding it.
+ FlagCallbackFunc cb = callback_->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
// re-locked back after call to callback is completed. Callback invocation is
@@ -340,23 +340,23 @@ 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.
- MutexRelock relock(*DataGuard());
- absl::MutexLock lock(&callback_->guard);
- cb();
-}
-
-std::unique_ptr<FlagStateInterface> FlagImpl::SaveState() {
- absl::MutexLock l(DataGuard());
-
- bool modified = modified_;
- bool on_command_line = on_command_line_;
- switch (ValueStorageKind()) {
+ MutexRelock relock(*DataGuard());
+ absl::MutexLock lock(&callback_->guard);
+ cb();
+}
+
+std::unique_ptr<FlagStateInterface> FlagImpl::SaveState() {
+ absl::MutexLock l(DataGuard());
+
+ bool modified = modified_;
+ bool on_command_line = on_command_line_;
+ switch (ValueStorageKind()) {
case FlagValueStorageKind::kValueAndInitBit:
- case FlagValueStorageKind::kOneWordAtomic: {
- return absl::make_unique<FlagState>(
- *this, OneWordValue().load(std::memory_order_acquire), modified,
+ case FlagValueStorageKind::kOneWordAtomic: {
+ return absl::make_unique<FlagState>(
+ *this, OneWordValue().load(std::memory_order_acquire), modified,
on_command_line, ModificationCount());
- }
+ }
case FlagValueStorageKind::kSequenceLocked: {
void* cloned = flags_internal::Alloc(op_);
// Read is guaranteed to be successful because we hold the lock.
@@ -366,97 +366,97 @@ std::unique_ptr<FlagStateInterface> FlagImpl::SaveState() {
static_cast<void>(success);
return absl::make_unique<FlagState>(*this, cloned, modified,
on_command_line, ModificationCount());
- }
+ }
case FlagValueStorageKind::kAlignedBuffer: {
return absl::make_unique<FlagState>(
*this, flags_internal::Clone(op_, AlignedBufferValue()), modified,
on_command_line, ModificationCount());
}
}
- return nullptr;
+ return nullptr;
}
-bool FlagImpl::RestoreState(const FlagState& flag_state) {
- absl::MutexLock l(DataGuard());
+bool FlagImpl::RestoreState(const FlagState& flag_state) {
+ absl::MutexLock l(DataGuard());
if (flag_state.counter_ == ModificationCount()) {
- return false;
+ return false;
}
- switch (ValueStorageKind()) {
+ switch (ValueStorageKind()) {
case FlagValueStorageKind::kValueAndInitBit:
case FlagValueStorageKind::kOneWordAtomic:
StoreValue(&flag_state.value_.one_word);
break;
case FlagValueStorageKind::kSequenceLocked:
- case FlagValueStorageKind::kAlignedBuffer:
- StoreValue(flag_state.value_.heap_allocated);
- break;
- }
+ case FlagValueStorageKind::kAlignedBuffer:
+ StoreValue(flag_state.value_.heap_allocated);
+ break;
+ }
- modified_ = flag_state.modified_;
- on_command_line_ = flag_state.on_command_line_;
+ modified_ = flag_state.modified_;
+ on_command_line_ = flag_state.on_command_line_;
return true;
}
-template <typename StorageT>
-StorageT* FlagImpl::OffsetValue() const {
- char* p = reinterpret_cast<char*>(const_cast<FlagImpl*>(this));
- // The offset is deduced via Flag value type specific op_.
- size_t offset = flags_internal::ValueOffset(op_);
-
- return reinterpret_cast<StorageT*>(p + offset);
-}
-
-void* FlagImpl::AlignedBufferValue() const {
- assert(ValueStorageKind() == FlagValueStorageKind::kAlignedBuffer);
- return OffsetValue<void>();
-}
-
+template <typename StorageT>
+StorageT* FlagImpl::OffsetValue() const {
+ char* p = reinterpret_cast<char*>(const_cast<FlagImpl*>(this));
+ // The offset is deduced via Flag value type specific op_.
+ size_t offset = flags_internal::ValueOffset(op_);
+
+ return reinterpret_cast<StorageT*>(p + offset);
+}
+
+void* FlagImpl::AlignedBufferValue() const {
+ assert(ValueStorageKind() == FlagValueStorageKind::kAlignedBuffer);
+ return OffsetValue<void>();
+}
+
std::atomic<uint64_t>* FlagImpl::AtomicBufferValue() const {
assert(ValueStorageKind() == FlagValueStorageKind::kSequenceLocked);
return OffsetValue<std::atomic<uint64_t>>();
}
-std::atomic<int64_t>& FlagImpl::OneWordValue() const {
+std::atomic<int64_t>& FlagImpl::OneWordValue() const {
assert(ValueStorageKind() == FlagValueStorageKind::kOneWordAtomic ||
ValueStorageKind() == FlagValueStorageKind::kValueAndInitBit);
- return OffsetValue<FlagOneWordValue>()->value;
-}
-
+ return OffsetValue<FlagOneWordValue>()->value;
+}
+
// Attempts to parse supplied `value` string using parsing routine in the `flag`
-// 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'
-std::unique_ptr<void, DynValueDeleter> FlagImpl::TryParse(
- absl::string_view value, std::string& err) const {
- std::unique_ptr<void, DynValueDeleter> tentative_value = MakeInitValue();
-
+// 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'
+std::unique_ptr<void, DynValueDeleter> FlagImpl::TryParse(
+ absl::string_view value, std::string& err) const {
+ std::unique_ptr<void, DynValueDeleter> tentative_value = MakeInitValue();
+
std::string parse_err;
- if (!flags_internal::Parse(op_, value, tentative_value.get(), &parse_err)) {
+ if (!flags_internal::Parse(op_, value, tentative_value.get(), &parse_err)) {
absl::string_view err_sep = parse_err.empty() ? "" : "; ";
- err = absl::StrCat("Illegal value '", value, "' specified for flag '",
- Name(), "'", err_sep, parse_err);
- return nullptr;
+ err = absl::StrCat("Illegal value '", value, "' specified for flag '",
+ Name(), "'", err_sep, parse_err);
+ return nullptr;
}
- return tentative_value;
+ return tentative_value;
}
-void FlagImpl::Read(void* dst) const {
- auto* guard = DataGuard(); // Make sure flag initialized
- switch (ValueStorageKind()) {
+void FlagImpl::Read(void* dst) const {
+ auto* guard = DataGuard(); // Make sure flag initialized
+ switch (ValueStorageKind()) {
case FlagValueStorageKind::kValueAndInitBit:
- case FlagValueStorageKind::kOneWordAtomic: {
- const int64_t one_word_val =
- OneWordValue().load(std::memory_order_acquire);
- std::memcpy(dst, &one_word_val, Sizeof(op_));
- break;
- }
+ case FlagValueStorageKind::kOneWordAtomic: {
+ const int64_t one_word_val =
+ OneWordValue().load(std::memory_order_acquire);
+ std::memcpy(dst, &one_word_val, Sizeof(op_));
+ break;
+ }
case FlagValueStorageKind::kSequenceLocked: {
ReadSequenceLockedData(dst);
- break;
- }
+ break;
+ }
case FlagValueStorageKind::kAlignedBuffer: {
absl::MutexLock l(guard);
flags_internal::CopyConstruct(op_, AlignedBufferValue(), dst);
@@ -496,21 +496,21 @@ void FlagImpl::ReadSequenceLockedData(void* dst) const {
static_cast<void>(success);
}
-void FlagImpl::Write(const void* src) {
+void FlagImpl::Write(const void* src) {
absl::MutexLock l(DataGuard());
- if (ShouldValidateFlagValue(flags_internal::FastTypeId(op_))) {
- std::unique_ptr<void, DynValueDeleter> obj{flags_internal::Clone(op_, src),
- DynValueDeleter{op_}};
+ if (ShouldValidateFlagValue(flags_internal::FastTypeId(op_))) {
+ std::unique_ptr<void, DynValueDeleter> obj{flags_internal::Clone(op_, src),
+ DynValueDeleter{op_}};
std::string ignored_error;
- std::string src_as_str = flags_internal::Unparse(op_, src);
- if (!flags_internal::Parse(op_, src_as_str, obj.get(), &ignored_error)) {
- ABSL_INTERNAL_LOG(ERROR, absl::StrCat("Attempt to set flag '", Name(),
- "' to invalid value ", src_as_str));
+ std::string src_as_str = flags_internal::Unparse(op_, src);
+ if (!flags_internal::Parse(op_, src_as_str, obj.get(), &ignored_error)) {
+ ABSL_INTERNAL_LOG(ERROR, absl::StrCat("Attempt to set flag '", Name(),
+ "' to invalid value ", src_as_str));
}
}
- StoreValue(src);
+ StoreValue(src);
}
// Sets the value of the flag based on specified string `value`. If the flag
@@ -521,18 +521,18 @@ void FlagImpl::Write(const void* src) {
// * Update the flag's default value
// * Update the current flag value if it was never set before
// The mode is selected based on 'set_mode' parameter.
-bool FlagImpl::ParseFrom(absl::string_view value, FlagSettingMode set_mode,
- ValueSource source, std::string& err) {
+bool FlagImpl::ParseFrom(absl::string_view value, FlagSettingMode set_mode,
+ ValueSource source, std::string& err) {
absl::MutexLock l(DataGuard());
switch (set_mode) {
case SET_FLAGS_VALUE: {
// set or modify the flag's value
- auto tentative_value = TryParse(value, err);
- if (!tentative_value) return false;
-
- StoreValue(tentative_value.get());
+ auto tentative_value = TryParse(value, err);
+ if (!tentative_value) return false;
+ StoreValue(tentative_value.get());
+
if (source == kCommandLine) {
on_command_line_ = true;
}
@@ -540,7 +540,7 @@ bool FlagImpl::ParseFrom(absl::string_view value, FlagSettingMode set_mode,
}
case SET_FLAG_IF_DEFAULT: {
// set the flag's value, but only if it hasn't been set by someone else
- if (modified_) {
+ if (modified_) {
// TODO(rogeeff): review and fix this semantic. Currently we do not fail
// in this case if flag is modified. This is misleading since the flag's
// value is not updated even though we return true.
@@ -549,29 +549,29 @@ bool FlagImpl::ParseFrom(absl::string_view value, FlagSettingMode set_mode,
// return false;
return true;
}
- auto tentative_value = TryParse(value, err);
- if (!tentative_value) return false;
-
- StoreValue(tentative_value.get());
+ auto tentative_value = TryParse(value, err);
+ if (!tentative_value) return false;
+
+ StoreValue(tentative_value.get());
break;
}
case SET_FLAGS_DEFAULT: {
- auto tentative_value = TryParse(value, err);
- if (!tentative_value) return false;
-
- if (DefaultKind() == FlagDefaultKind::kDynamicValue) {
- void* old_value = default_value_.dynamic_value;
- default_value_.dynamic_value = tentative_value.release();
- tentative_value.reset(old_value);
- } else {
- default_value_.dynamic_value = tentative_value.release();
- def_kind_ = static_cast<uint8_t>(FlagDefaultKind::kDynamicValue);
- }
-
+ auto tentative_value = TryParse(value, err);
+ if (!tentative_value) return false;
+
+ if (DefaultKind() == FlagDefaultKind::kDynamicValue) {
+ void* old_value = default_value_.dynamic_value;
+ default_value_.dynamic_value = tentative_value.release();
+ tentative_value.reset(old_value);
+ } else {
+ default_value_.dynamic_value = tentative_value.release();
+ def_kind_ = static_cast<uint8_t>(FlagDefaultKind::kDynamicValue);
+ }
+
if (!modified_) {
- // Need to set both default value *and* current, in this case.
- StoreValue(default_value_.dynamic_value);
- modified_ = false;
+ // Need to set both default value *and* current, in this case.
+ StoreValue(default_value_.dynamic_value);
+ modified_ = false;
}
break;
}
@@ -580,18 +580,18 @@ bool FlagImpl::ParseFrom(absl::string_view value, FlagSettingMode set_mode,
return true;
}
-void FlagImpl::CheckDefaultValueParsingRoundtrip() const {
+void FlagImpl::CheckDefaultValueParsingRoundtrip() const {
std::string v = DefaultValue();
absl::MutexLock lock(DataGuard());
- auto dst = MakeInitValue();
+ auto dst = MakeInitValue();
std::string error;
- if (!flags_internal::Parse(op_, v, dst.get(), &error)) {
+ if (!flags_internal::Parse(op_, v, dst.get(), &error)) {
ABSL_INTERNAL_LOG(
FATAL,
- absl::StrCat("Flag ", Name(), " (from ", Filename(),
- "): string form of default value '", v,
+ absl::StrCat("Flag ", Name(), " (from ", Filename(),
+ "): string form of default value '", v,
"' could not be parsed; error=", error));
}
@@ -602,11 +602,11 @@ void FlagImpl::CheckDefaultValueParsingRoundtrip() const {
bool FlagImpl::ValidateInputValue(absl::string_view value) const {
absl::MutexLock l(DataGuard());
- auto obj = MakeInitValue();
+ auto obj = MakeInitValue();
std::string ignored_error;
- return flags_internal::Parse(op_, value, obj.get(), &ignored_error);
+ return flags_internal::Parse(op_, value, obj.get(), &ignored_error);
}
} // namespace flags_internal
-ABSL_NAMESPACE_END
+ABSL_NAMESPACE_END
} // namespace absl
diff --git a/contrib/restricted/abseil-cpp/absl/flags/internal/flag.h b/contrib/restricted/abseil-cpp/absl/flags/internal/flag.h
index 124a2f1c03..6129f1b2a8 100644
--- a/contrib/restricted/abseil-cpp/absl/flags/internal/flag.h
+++ b/contrib/restricted/abseil-cpp/absl/flags/internal/flag.h
@@ -16,319 +16,319 @@
#ifndef ABSL_FLAGS_INTERNAL_FLAG_H_
#define ABSL_FLAGS_INTERNAL_FLAG_H_
-#include <stddef.h>
-#include <stdint.h>
-
+#include <stddef.h>
+#include <stdint.h>
+
#include <atomic>
#include <cstring>
-#include <memory>
-#include <new>
-#include <string>
-#include <type_traits>
-#include <typeinfo>
-
-#include "absl/base/attributes.h"
-#include "absl/base/call_once.h"
+#include <memory>
+#include <new>
+#include <string>
+#include <type_traits>
+#include <typeinfo>
+
+#include "absl/base/attributes.h"
+#include "absl/base/call_once.h"
#include "absl/base/casts.h"
-#include "absl/base/config.h"
-#include "absl/base/optimization.h"
+#include "absl/base/config.h"
+#include "absl/base/optimization.h"
#include "absl/base/thread_annotations.h"
-#include "absl/flags/commandlineflag.h"
-#include "absl/flags/config.h"
+#include "absl/flags/commandlineflag.h"
+#include "absl/flags/config.h"
#include "absl/flags/internal/commandlineflag.h"
#include "absl/flags/internal/registry.h"
#include "absl/flags/internal/sequence_lock.h"
-#include "absl/flags/marshalling.h"
-#include "absl/meta/type_traits.h"
-#include "absl/strings/string_view.h"
+#include "absl/flags/marshalling.h"
+#include "absl/meta/type_traits.h"
+#include "absl/strings/string_view.h"
#include "absl/synchronization/mutex.h"
-#include "absl/utility/utility.h"
+#include "absl/utility/utility.h"
namespace absl {
-ABSL_NAMESPACE_BEGIN
-
-///////////////////////////////////////////////////////////////////////////////
-// Forward declaration of absl::Flag<T> public API.
+ABSL_NAMESPACE_BEGIN
+
+///////////////////////////////////////////////////////////////////////////////
+// Forward declaration of absl::Flag<T> public API.
namespace flags_internal {
-template <typename T>
-class Flag;
-} // namespace flags_internal
+template <typename T>
+class Flag;
+} // namespace flags_internal
-#if defined(_MSC_VER) && !defined(__clang__)
+#if defined(_MSC_VER) && !defined(__clang__)
template <typename T>
class Flag;
-#else
-template <typename T>
-using Flag = flags_internal::Flag<T>;
-#endif
-
-template <typename T>
-ABSL_MUST_USE_RESULT T GetFlag(const absl::Flag<T>& flag);
+#else
+template <typename T>
+using Flag = flags_internal::Flag<T>;
+#endif
template <typename T>
-void SetFlag(absl::Flag<T>* flag, const T& v);
-
-template <typename T, typename V>
-void SetFlag(absl::Flag<T>* flag, const V& v);
-
-template <typename U>
-const CommandLineFlag& GetFlagReflectionHandle(const absl::Flag<U>& f);
-
-///////////////////////////////////////////////////////////////////////////////
-// Flag value type operations, eg., parsing, copying, etc. are provided
-// by function specific to that type with a signature matching FlagOpFn.
-
-namespace flags_internal {
-
-enum class FlagOp {
- kAlloc,
- kDelete,
- kCopy,
- kCopyConstruct,
- kSizeof,
- kFastTypeId,
- kRuntimeTypeId,
- kParse,
- kUnparse,
- kValueOffset,
+ABSL_MUST_USE_RESULT T GetFlag(const absl::Flag<T>& flag);
+
+template <typename T>
+void SetFlag(absl::Flag<T>* flag, const T& v);
+
+template <typename T, typename V>
+void SetFlag(absl::Flag<T>* flag, const V& v);
+
+template <typename U>
+const CommandLineFlag& GetFlagReflectionHandle(const absl::Flag<U>& f);
+
+///////////////////////////////////////////////////////////////////////////////
+// Flag value type operations, eg., parsing, copying, etc. are provided
+// by function specific to that type with a signature matching FlagOpFn.
+
+namespace flags_internal {
+
+enum class FlagOp {
+ kAlloc,
+ kDelete,
+ kCopy,
+ kCopyConstruct,
+ kSizeof,
+ kFastTypeId,
+ kRuntimeTypeId,
+ kParse,
+ kUnparse,
+ kValueOffset,
};
-using FlagOpFn = void* (*)(FlagOp, const void*, void*, void*);
-
-// Forward declaration for Flag value specific operations.
-template <typename T>
-void* FlagOps(FlagOp op, const void* v1, void* v2, void* v3);
-
-// Allocate aligned memory for a flag value.
-inline void* Alloc(FlagOpFn op) {
- return op(FlagOp::kAlloc, nullptr, nullptr, nullptr);
-}
-// Deletes memory interpreting obj as flag value type pointer.
-inline void Delete(FlagOpFn op, void* obj) {
- op(FlagOp::kDelete, nullptr, obj, nullptr);
-}
-// Copies src to dst interpreting as flag value type pointers.
-inline void Copy(FlagOpFn op, const void* src, void* dst) {
- op(FlagOp::kCopy, src, dst, nullptr);
-}
-// Construct a copy of flag value in a location pointed by dst
-// based on src - pointer to the flag's value.
-inline void CopyConstruct(FlagOpFn op, const void* src, void* dst) {
- op(FlagOp::kCopyConstruct, src, dst, nullptr);
-}
-// Makes a copy of flag value pointed by obj.
-inline void* Clone(FlagOpFn op, const void* obj) {
- void* res = flags_internal::Alloc(op);
- flags_internal::CopyConstruct(op, obj, res);
- return res;
-}
-// Returns true if parsing of input text is successfull.
-inline bool Parse(FlagOpFn op, absl::string_view text, void* dst,
- std::string* error) {
- return op(FlagOp::kParse, &text, dst, error) != nullptr;
-}
-// Returns string representing supplied value.
-inline std::string Unparse(FlagOpFn op, const void* val) {
- std::string result;
- op(FlagOp::kUnparse, val, &result, nullptr);
- return result;
-}
-// Returns size of flag value type.
-inline size_t Sizeof(FlagOpFn op) {
- // This sequence of casts reverses the sequence from
- // `flags_internal::FlagOps()`
- return static_cast<size_t>(reinterpret_cast<intptr_t>(
- op(FlagOp::kSizeof, nullptr, nullptr, nullptr)));
-}
-// Returns fast type id coresponding to the value type.
-inline FlagFastTypeId FastTypeId(FlagOpFn op) {
- return reinterpret_cast<FlagFastTypeId>(
- op(FlagOp::kFastTypeId, nullptr, nullptr, nullptr));
-}
-// Returns fast type id coresponding to the value type.
-inline const std::type_info* RuntimeTypeId(FlagOpFn op) {
- return reinterpret_cast<const std::type_info*>(
- op(FlagOp::kRuntimeTypeId, nullptr, nullptr, nullptr));
-}
-// Returns offset of the field value_ from the field impl_ inside of
-// absl::Flag<T> data. Given FlagImpl pointer p you can get the
-// location of the corresponding value as:
-// reinterpret_cast<char*>(p) + ValueOffset().
-inline ptrdiff_t ValueOffset(FlagOpFn op) {
- // This sequence of casts reverses the sequence from
- // `flags_internal::FlagOps()`
- return static_cast<ptrdiff_t>(reinterpret_cast<intptr_t>(
- op(FlagOp::kValueOffset, nullptr, nullptr, nullptr)));
-}
-
-// Returns an address of RTTI's typeid(T).
-template <typename T>
-inline const std::type_info* GenRuntimeTypeId() {
-#if defined(ABSL_FLAGS_INTERNAL_HAS_RTTI)
- return &typeid(T);
-#else
- return nullptr;
-#endif
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// Flag help auxiliary structs.
-
+using FlagOpFn = void* (*)(FlagOp, const void*, void*, void*);
+
+// Forward declaration for Flag value specific operations.
+template <typename T>
+void* FlagOps(FlagOp op, const void* v1, void* v2, void* v3);
+
+// Allocate aligned memory for a flag value.
+inline void* Alloc(FlagOpFn op) {
+ return op(FlagOp::kAlloc, nullptr, nullptr, nullptr);
+}
+// Deletes memory interpreting obj as flag value type pointer.
+inline void Delete(FlagOpFn op, void* obj) {
+ op(FlagOp::kDelete, nullptr, obj, nullptr);
+}
+// Copies src to dst interpreting as flag value type pointers.
+inline void Copy(FlagOpFn op, const void* src, void* dst) {
+ op(FlagOp::kCopy, src, dst, nullptr);
+}
+// Construct a copy of flag value in a location pointed by dst
+// based on src - pointer to the flag's value.
+inline void CopyConstruct(FlagOpFn op, const void* src, void* dst) {
+ op(FlagOp::kCopyConstruct, src, dst, nullptr);
+}
+// Makes a copy of flag value pointed by obj.
+inline void* Clone(FlagOpFn op, const void* obj) {
+ void* res = flags_internal::Alloc(op);
+ flags_internal::CopyConstruct(op, obj, res);
+ return res;
+}
+// Returns true if parsing of input text is successfull.
+inline bool Parse(FlagOpFn op, absl::string_view text, void* dst,
+ std::string* error) {
+ return op(FlagOp::kParse, &text, dst, error) != nullptr;
+}
+// Returns string representing supplied value.
+inline std::string Unparse(FlagOpFn op, const void* val) {
+ std::string result;
+ op(FlagOp::kUnparse, val, &result, nullptr);
+ return result;
+}
+// Returns size of flag value type.
+inline size_t Sizeof(FlagOpFn op) {
+ // This sequence of casts reverses the sequence from
+ // `flags_internal::FlagOps()`
+ return static_cast<size_t>(reinterpret_cast<intptr_t>(
+ op(FlagOp::kSizeof, nullptr, nullptr, nullptr)));
+}
+// Returns fast type id coresponding to the value type.
+inline FlagFastTypeId FastTypeId(FlagOpFn op) {
+ return reinterpret_cast<FlagFastTypeId>(
+ op(FlagOp::kFastTypeId, nullptr, nullptr, nullptr));
+}
+// Returns fast type id coresponding to the value type.
+inline const std::type_info* RuntimeTypeId(FlagOpFn op) {
+ return reinterpret_cast<const std::type_info*>(
+ op(FlagOp::kRuntimeTypeId, nullptr, nullptr, nullptr));
+}
+// Returns offset of the field value_ from the field impl_ inside of
+// absl::Flag<T> data. Given FlagImpl pointer p you can get the
+// location of the corresponding value as:
+// reinterpret_cast<char*>(p) + ValueOffset().
+inline ptrdiff_t ValueOffset(FlagOpFn op) {
+ // This sequence of casts reverses the sequence from
+ // `flags_internal::FlagOps()`
+ return static_cast<ptrdiff_t>(reinterpret_cast<intptr_t>(
+ op(FlagOp::kValueOffset, nullptr, nullptr, nullptr)));
+}
+
+// Returns an address of RTTI's typeid(T).
+template <typename T>
+inline const std::type_info* GenRuntimeTypeId() {
+#if defined(ABSL_FLAGS_INTERNAL_HAS_RTTI)
+ return &typeid(T);
+#else
+ return nullptr;
+#endif
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// Flag help auxiliary structs.
+
// This is help argument for absl::Flag encapsulating the string literal pointer
// or pointer to function generating it as well as enum descriminating two
// cases.
using HelpGenFunc = std::string (*)();
-template <size_t N>
-struct FixedCharArray {
- char value[N];
-
- template <size_t... I>
- static constexpr FixedCharArray<N> FromLiteralString(
- absl::string_view str, absl::index_sequence<I...>) {
- return (void)str, FixedCharArray<N>({{str[I]..., '\0'}});
- }
-};
-
-template <typename Gen, size_t N = Gen::Value().size()>
-constexpr FixedCharArray<N + 1> HelpStringAsArray(int) {
- return FixedCharArray<N + 1>::FromLiteralString(
- Gen::Value(), absl::make_index_sequence<N>{});
-}
-
-template <typename Gen>
-constexpr std::false_type HelpStringAsArray(char) {
- return std::false_type{};
-}
-
-union FlagHelpMsg {
- constexpr explicit FlagHelpMsg(const char* help_msg) : literal(help_msg) {}
- constexpr explicit FlagHelpMsg(HelpGenFunc help_gen) : gen_func(help_gen) {}
-
+template <size_t N>
+struct FixedCharArray {
+ char value[N];
+
+ template <size_t... I>
+ static constexpr FixedCharArray<N> FromLiteralString(
+ absl::string_view str, absl::index_sequence<I...>) {
+ return (void)str, FixedCharArray<N>({{str[I]..., '\0'}});
+ }
+};
+
+template <typename Gen, size_t N = Gen::Value().size()>
+constexpr FixedCharArray<N + 1> HelpStringAsArray(int) {
+ return FixedCharArray<N + 1>::FromLiteralString(
+ Gen::Value(), absl::make_index_sequence<N>{});
+}
+
+template <typename Gen>
+constexpr std::false_type HelpStringAsArray(char) {
+ return std::false_type{};
+}
+
+union FlagHelpMsg {
+ constexpr explicit FlagHelpMsg(const char* help_msg) : literal(help_msg) {}
+ constexpr explicit FlagHelpMsg(HelpGenFunc help_gen) : gen_func(help_gen) {}
+
const char* literal;
HelpGenFunc gen_func;
};
-enum class FlagHelpKind : uint8_t { kLiteral = 0, kGenFunc = 1 };
+enum class FlagHelpKind : uint8_t { kLiteral = 0, kGenFunc = 1 };
-struct FlagHelpArg {
- FlagHelpMsg source;
- FlagHelpKind kind;
+struct FlagHelpArg {
+ FlagHelpMsg source;
+ FlagHelpKind kind;
};
-extern const char kStrippedFlagHelp[];
+extern const char kStrippedFlagHelp[];
// These two HelpArg overloads allows us to select at compile time one of two
// way to pass Help argument to absl::Flag. We'll be passing
-// AbslFlagHelpGenFor##name as Gen and integer 0 as a single argument to prefer
-// first overload if possible. If help message is evaluatable on constexpr
-// context We'll be able to make FixedCharArray out of it and we'll choose first
-// overload. In this case the help message expression is immediately evaluated
-// and is used to construct the absl::Flag. No additionl code is generated by
-// ABSL_FLAG Otherwise SFINAE kicks in and first overload is dropped from the
+// AbslFlagHelpGenFor##name as Gen and integer 0 as a single argument to prefer
+// first overload if possible. If help message is evaluatable on constexpr
+// context We'll be able to make FixedCharArray out of it and we'll choose first
+// overload. In this case the help message expression is immediately evaluated
+// and is used to construct the absl::Flag. No additionl code is generated by
+// ABSL_FLAG Otherwise SFINAE kicks in and first overload is dropped from the
// consideration, in which case the second overload will be used. The second
// overload does not attempt to evaluate the help message expression
// immediately and instead delays the evaluation by returing the function
// pointer (&T::NonConst) genering the help message when necessary. This is
// evaluatable in constexpr context, but the cost is an extra function being
// generated in the ABSL_FLAG code.
-template <typename Gen, size_t N>
-constexpr FlagHelpArg HelpArg(const FixedCharArray<N>& value) {
- return {FlagHelpMsg(value.value), FlagHelpKind::kLiteral};
+template <typename Gen, size_t N>
+constexpr FlagHelpArg HelpArg(const FixedCharArray<N>& value) {
+ return {FlagHelpMsg(value.value), FlagHelpKind::kLiteral};
}
-template <typename Gen>
-constexpr FlagHelpArg HelpArg(std::false_type) {
- return {FlagHelpMsg(&Gen::NonConst), FlagHelpKind::kGenFunc};
+template <typename Gen>
+constexpr FlagHelpArg HelpArg(std::false_type) {
+ return {FlagHelpMsg(&Gen::NonConst), FlagHelpKind::kGenFunc};
}
-///////////////////////////////////////////////////////////////////////////////
-// Flag default value auxiliary structs.
-
-// Signature for the function generating the initial flag value (usually
+///////////////////////////////////////////////////////////////////////////////
+// Flag default value auxiliary structs.
+
+// Signature for the function generating the initial flag value (usually
// based on default value supplied in flag's definition)
-using FlagDfltGenFunc = void (*)(void*);
-
-union FlagDefaultSrc {
- constexpr explicit FlagDefaultSrc(FlagDfltGenFunc gen_func_arg)
- : gen_func(gen_func_arg) {}
-
-#define ABSL_FLAGS_INTERNAL_DFLT_FOR_TYPE(T, name) \
- T name##_value; \
- constexpr explicit FlagDefaultSrc(T value) : name##_value(value) {} // NOLINT
- ABSL_FLAGS_INTERNAL_BUILTIN_TYPES(ABSL_FLAGS_INTERNAL_DFLT_FOR_TYPE)
-#undef ABSL_FLAGS_INTERNAL_DFLT_FOR_TYPE
-
- void* dynamic_value;
- FlagDfltGenFunc gen_func;
-};
-
-enum class FlagDefaultKind : uint8_t {
- kDynamicValue = 0,
- kGenFunc = 1,
- kOneWord = 2 // for default values UP to one word in size
-};
-
-struct FlagDefaultArg {
- FlagDefaultSrc source;
- FlagDefaultKind kind;
-};
-
-// This struct and corresponding overload to InitDefaultValue are used to
-// facilitate usage of {} as default value in ABSL_FLAG macro.
-// TODO(rogeeff): Fix handling types with explicit constructors.
-struct EmptyBraces {};
-
-template <typename T>
-constexpr T InitDefaultValue(T t) {
- return t;
-}
-
-template <typename T>
-constexpr T InitDefaultValue(EmptyBraces) {
- return T{};
-}
-
-template <typename ValueT, typename GenT,
- typename std::enable_if<std::is_integral<ValueT>::value, int>::type =
+using FlagDfltGenFunc = void (*)(void*);
+
+union FlagDefaultSrc {
+ constexpr explicit FlagDefaultSrc(FlagDfltGenFunc gen_func_arg)
+ : gen_func(gen_func_arg) {}
+
+#define ABSL_FLAGS_INTERNAL_DFLT_FOR_TYPE(T, name) \
+ T name##_value; \
+ constexpr explicit FlagDefaultSrc(T value) : name##_value(value) {} // NOLINT
+ ABSL_FLAGS_INTERNAL_BUILTIN_TYPES(ABSL_FLAGS_INTERNAL_DFLT_FOR_TYPE)
+#undef ABSL_FLAGS_INTERNAL_DFLT_FOR_TYPE
+
+ void* dynamic_value;
+ FlagDfltGenFunc gen_func;
+};
+
+enum class FlagDefaultKind : uint8_t {
+ kDynamicValue = 0,
+ kGenFunc = 1,
+ kOneWord = 2 // for default values UP to one word in size
+};
+
+struct FlagDefaultArg {
+ FlagDefaultSrc source;
+ FlagDefaultKind kind;
+};
+
+// This struct and corresponding overload to InitDefaultValue are used to
+// facilitate usage of {} as default value in ABSL_FLAG macro.
+// TODO(rogeeff): Fix handling types with explicit constructors.
+struct EmptyBraces {};
+
+template <typename T>
+constexpr T InitDefaultValue(T t) {
+ return t;
+}
+
+template <typename T>
+constexpr T InitDefaultValue(EmptyBraces) {
+ return T{};
+}
+
+template <typename ValueT, typename GenT,
+ typename std::enable_if<std::is_integral<ValueT>::value, int>::type =
((void)GenT{}, 0)>
-constexpr FlagDefaultArg DefaultArg(int) {
- return {FlagDefaultSrc(GenT{}.value), FlagDefaultKind::kOneWord};
-}
-
-template <typename ValueT, typename GenT>
-constexpr FlagDefaultArg DefaultArg(char) {
- return {FlagDefaultSrc(&GenT::Gen), FlagDefaultKind::kGenFunc};
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// Flag current value auxiliary structs.
-
-constexpr int64_t UninitializedFlagValue() { return 0xababababababababll; }
-
-template <typename T>
+constexpr FlagDefaultArg DefaultArg(int) {
+ return {FlagDefaultSrc(GenT{}.value), FlagDefaultKind::kOneWord};
+}
+
+template <typename ValueT, typename GenT>
+constexpr FlagDefaultArg DefaultArg(char) {
+ return {FlagDefaultSrc(&GenT::Gen), FlagDefaultKind::kGenFunc};
+}
+
+///////////////////////////////////////////////////////////////////////////////
+// Flag current value auxiliary structs.
+
+constexpr int64_t UninitializedFlagValue() { return 0xababababababababll; }
+
+template <typename T>
using FlagUseValueAndInitBitStorage = std::integral_constant<
bool, absl::type_traits_internal::is_trivially_copyable<T>::value &&
std::is_default_constructible<T>::value && (sizeof(T) < 8)>;
template <typename T>
-using FlagUseOneWordStorage = std::integral_constant<
- bool, absl::type_traits_internal::is_trivially_copyable<T>::value &&
- (sizeof(T) <= 8)>;
-
+using FlagUseOneWordStorage = std::integral_constant<
+ bool, absl::type_traits_internal::is_trivially_copyable<T>::value &&
+ (sizeof(T) <= 8)>;
+
template <class T>
using FlagUseSequenceLockStorage = std::integral_constant<
- bool, absl::type_traits_internal::is_trivially_copyable<T>::value &&
+ bool, absl::type_traits_internal::is_trivially_copyable<T>::value &&
(sizeof(T) > 8)>;
-
-enum class FlagValueStorageKind : uint8_t {
+
+enum class FlagValueStorageKind : uint8_t {
kValueAndInitBit = 0,
- kOneWordAtomic = 1,
+ kOneWordAtomic = 1,
kSequenceLocked = 2,
kAlignedBuffer = 3,
-};
-
-template <typename T>
-static constexpr FlagValueStorageKind StorageKind() {
+};
+
+template <typename T>
+static constexpr FlagValueStorageKind StorageKind() {
return FlagUseValueAndInitBitStorage<T>::value
? FlagValueStorageKind::kValueAndInitBit
: FlagUseOneWordStorage<T>::value
@@ -336,13 +336,13 @@ static constexpr FlagValueStorageKind StorageKind() {
: FlagUseSequenceLockStorage<T>::value
? FlagValueStorageKind::kSequenceLocked
: FlagValueStorageKind::kAlignedBuffer;
-}
-
-struct FlagOneWordValue {
+}
+
+struct FlagOneWordValue {
constexpr explicit FlagOneWordValue(int64_t v) : value(v) {}
- std::atomic<int64_t> value;
-};
-
+ std::atomic<int64_t> value;
+};
+
template <typename T>
struct alignas(8) FlagValueAndInitBit {
T value;
@@ -351,11 +351,11 @@ struct alignas(8) FlagValueAndInitBit {
uint8_t init;
};
-template <typename T,
- FlagValueStorageKind Kind = flags_internal::StorageKind<T>()>
-struct FlagValue;
-
-template <typename T>
+template <typename T,
+ FlagValueStorageKind Kind = flags_internal::StorageKind<T>()>
+struct FlagValue;
+
+template <typename T>
struct FlagValue<T, FlagValueStorageKind::kValueAndInitBit> : FlagOneWordValue {
constexpr FlagValue() : FlagOneWordValue(0) {}
bool Get(const SequenceLock&, T& dst) const {
@@ -366,34 +366,34 @@ struct FlagValue<T, FlagValueStorageKind::kValueAndInitBit> : FlagOneWordValue {
dst = absl::bit_cast<FlagValueAndInitBit<T>>(storage).value;
return true;
}
-};
-
-template <typename T>
-struct FlagValue<T, FlagValueStorageKind::kOneWordAtomic> : FlagOneWordValue {
+};
+
+template <typename T>
+struct FlagValue<T, FlagValueStorageKind::kOneWordAtomic> : FlagOneWordValue {
constexpr FlagValue() : FlagOneWordValue(UninitializedFlagValue()) {}
bool Get(const SequenceLock&, T& dst) const {
- int64_t one_word_val = value.load(std::memory_order_acquire);
- if (ABSL_PREDICT_FALSE(one_word_val == UninitializedFlagValue())) {
- return false;
- }
- std::memcpy(&dst, static_cast<const void*>(&one_word_val), sizeof(T));
- return true;
- }
-};
-
-template <typename T>
+ int64_t one_word_val = value.load(std::memory_order_acquire);
+ if (ABSL_PREDICT_FALSE(one_word_val == UninitializedFlagValue())) {
+ return false;
+ }
+ std::memcpy(&dst, static_cast<const void*>(&one_word_val), sizeof(T));
+ return true;
+ }
+};
+
+template <typename T>
struct FlagValue<T, FlagValueStorageKind::kSequenceLocked> {
bool Get(const SequenceLock& lock, T& dst) const {
return lock.TryRead(&dst, value_words, sizeof(T));
- }
+ }
static constexpr int kNumWords =
flags_internal::AlignUp(sizeof(T), sizeof(uint64_t)) / sizeof(uint64_t);
alignas(T) alignas(
std::atomic<uint64_t>) std::atomic<uint64_t> value_words[kNumWords];
-};
-
+};
+
template <typename T>
struct FlagValue<T, FlagValueStorageKind::kAlignedBuffer> {
bool Get(const SequenceLock&, T&) const { return false; }
@@ -401,54 +401,54 @@ struct FlagValue<T, FlagValueStorageKind::kAlignedBuffer> {
alignas(T) char value[sizeof(T)];
};
-///////////////////////////////////////////////////////////////////////////////
-// Flag callback auxiliary structs.
-
+///////////////////////////////////////////////////////////////////////////////
+// Flag callback auxiliary structs.
+
// Signature for the mutation callback used by watched Flags
// The callback is noexcept.
// TODO(rogeeff): add noexcept after C++17 support is added.
-using FlagCallbackFunc = void (*)();
-
-struct FlagCallback {
- FlagCallbackFunc func;
- absl::Mutex guard; // Guard for concurrent callback invocations.
-};
-
-///////////////////////////////////////////////////////////////////////////////
-// Flag implementation, which does not depend on flag value type.
-// The class encapsulates the Flag's data and access to it.
-
-struct DynValueDeleter {
- explicit DynValueDeleter(FlagOpFn op_arg = nullptr);
- void operator()(void* ptr) const;
-
- FlagOpFn op;
-};
-
-class FlagState;
-
-class FlagImpl final : public CommandLineFlag {
+using FlagCallbackFunc = void (*)();
+
+struct FlagCallback {
+ FlagCallbackFunc func;
+ absl::Mutex guard; // Guard for concurrent callback invocations.
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// Flag implementation, which does not depend on flag value type.
+// The class encapsulates the Flag's data and access to it.
+
+struct DynValueDeleter {
+ explicit DynValueDeleter(FlagOpFn op_arg = nullptr);
+ void operator()(void* ptr) const;
+
+ FlagOpFn op;
+};
+
+class FlagState;
+
+class FlagImpl final : public CommandLineFlag {
public:
- constexpr FlagImpl(const char* name, const char* filename, FlagOpFn op,
- FlagHelpArg help, FlagValueStorageKind value_kind,
- FlagDefaultArg default_arg)
- : name_(name),
- filename_(filename),
- op_(op),
+ constexpr FlagImpl(const char* name, const char* filename, FlagOpFn op,
+ FlagHelpArg help, FlagValueStorageKind value_kind,
+ FlagDefaultArg default_arg)
+ : name_(name),
+ filename_(filename),
+ op_(op),
help_(help.source),
- help_source_kind_(static_cast<uint8_t>(help.kind)),
- value_storage_kind_(static_cast<uint8_t>(value_kind)),
- def_kind_(static_cast<uint8_t>(default_arg.kind)),
- modified_(false),
- on_command_line_(false),
- callback_(nullptr),
- default_value_(default_arg.source),
- data_guard_{} {}
+ help_source_kind_(static_cast<uint8_t>(help.kind)),
+ value_storage_kind_(static_cast<uint8_t>(value_kind)),
+ def_kind_(static_cast<uint8_t>(default_arg.kind)),
+ modified_(false),
+ on_command_line_(false),
+ callback_(nullptr),
+ default_value_(default_arg.source),
+ data_guard_{} {}
// Constant access methods
int64_t ReadOneWord() const ABSL_LOCKS_EXCLUDED(*DataGuard());
bool ReadOneBool() const ABSL_LOCKS_EXCLUDED(*DataGuard());
- void Read(void* dst) const override ABSL_LOCKS_EXCLUDED(*DataGuard());
+ void Read(void* dst) const override ABSL_LOCKS_EXCLUDED(*DataGuard());
void Read(bool* value) const ABSL_LOCKS_EXCLUDED(*DataGuard()) {
*value = ReadOneBool();
}
@@ -469,193 +469,193 @@ class FlagImpl final : public CommandLineFlag {
}
// Mutating access methods
- void Write(const void* src) ABSL_LOCKS_EXCLUDED(*DataGuard());
+ void Write(const void* src) ABSL_LOCKS_EXCLUDED(*DataGuard());
// Interfaces to operate on callbacks.
- void SetCallback(const FlagCallbackFunc mutation_callback)
- ABSL_LOCKS_EXCLUDED(*DataGuard());
- void InvokeCallback() const ABSL_EXCLUSIVE_LOCKS_REQUIRED(*DataGuard());
-
- // Used in read/write operations to validate source/target has correct type.
- // For example if flag is declared as absl::Flag<int> FLAGS_foo, a call to
- // absl::GetFlag(FLAGS_foo) validates that the type of FLAGS_foo is indeed
- // int. To do that we pass the "assumed" type id (which is deduced from type
- // int) as an argument `type_id`, which is in turn is validated against the
- // type id stored in flag object by flag definition statement.
- void AssertValidType(FlagFastTypeId type_id,
- const std::type_info* (*gen_rtti)()) const;
-
- private:
+ void SetCallback(const FlagCallbackFunc mutation_callback)
+ ABSL_LOCKS_EXCLUDED(*DataGuard());
+ void InvokeCallback() const ABSL_EXCLUSIVE_LOCKS_REQUIRED(*DataGuard());
+
+ // Used in read/write operations to validate source/target has correct type.
+ // For example if flag is declared as absl::Flag<int> FLAGS_foo, a call to
+ // absl::GetFlag(FLAGS_foo) validates that the type of FLAGS_foo is indeed
+ // int. To do that we pass the "assumed" type id (which is deduced from type
+ // int) as an argument `type_id`, which is in turn is validated against the
+ // type id stored in flag object by flag definition statement.
+ void AssertValidType(FlagFastTypeId type_id,
+ const std::type_info* (*gen_rtti)()) const;
+
+ private:
template <typename T>
- friend class Flag;
- friend class FlagState;
-
- // Ensures that `data_guard_` is initialized and returns it.
- absl::Mutex* DataGuard() const
- ABSL_LOCK_RETURNED(reinterpret_cast<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());
- // Flag initialization called via absl::call_once.
- void Init();
-
- // Offset value access methods. One per storage kind. These methods to not
- // respect const correctness, so be very carefull using them.
-
- // This is a shared helper routine which encapsulates most of the magic. Since
- // it is only used inside the three routines below, which are defined in
- // flag.cc, we can define it in that file as well.
- template <typename StorageT>
- StorageT* OffsetValue() const;
+ friend class Flag;
+ friend class FlagState;
+
+ // Ensures that `data_guard_` is initialized and returns it.
+ absl::Mutex* DataGuard() const
+ ABSL_LOCK_RETURNED(reinterpret_cast<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());
+ // Flag initialization called via absl::call_once.
+ void Init();
+
+ // Offset value access methods. One per storage kind. These methods to not
+ // respect const correctness, so be very carefull using them.
+
+ // This is a shared helper routine which encapsulates most of the magic. Since
+ // it is only used inside the three routines below, which are defined in
+ // flag.cc, we can define it in that file as well.
+ template <typename StorageT>
+ StorageT* OffsetValue() const;
// This is an accessor for a value stored in an aligned buffer storage
// used for non-trivially-copyable data types.
- // Returns a mutable pointer to the start of a buffer.
- void* AlignedBufferValue() const;
+ // Returns a mutable pointer to the start of a buffer.
+ void* AlignedBufferValue() const;
// The same as above, but used for sequencelock-protected storage.
std::atomic<uint64_t>* AtomicBufferValue() const;
- // This is an accessor for a value stored as one word atomic. Returns a
- // mutable reference to an atomic value.
- std::atomic<int64_t>& OneWordValue() const;
-
- // Attempts to parse supplied `value` string. If parsing is successful,
- // returns new value. Otherwise returns nullptr.
- std::unique_ptr<void, DynValueDeleter> TryParse(absl::string_view value,
- std::string& err) const
- ABSL_EXCLUSIVE_LOCKS_REQUIRED(*DataGuard());
- // Stores the flag value based on the pointer to the source.
- void StoreValue(const void* src) ABSL_EXCLUSIVE_LOCKS_REQUIRED(*DataGuard());
-
+ // This is an accessor for a value stored as one word atomic. Returns a
+ // mutable reference to an atomic value.
+ std::atomic<int64_t>& OneWordValue() const;
+
+ // Attempts to parse supplied `value` string. If parsing is successful,
+ // returns new value. Otherwise returns nullptr.
+ std::unique_ptr<void, DynValueDeleter> TryParse(absl::string_view value,
+ std::string& err) const
+ ABSL_EXCLUSIVE_LOCKS_REQUIRED(*DataGuard());
+ // Stores the flag value based on the pointer to the source.
+ void StoreValue(const void* src) ABSL_EXCLUSIVE_LOCKS_REQUIRED(*DataGuard());
+
// Copy the flag data, protected by `seq_lock_` into `dst`.
//
// REQUIRES: ValueStorageKind() == kSequenceLocked.
void ReadSequenceLockedData(void* dst) const
ABSL_LOCKS_EXCLUDED(*DataGuard());
- FlagHelpKind HelpSourceKind() const {
- return static_cast<FlagHelpKind>(help_source_kind_);
- }
- FlagValueStorageKind ValueStorageKind() const {
- return static_cast<FlagValueStorageKind>(value_storage_kind_);
- }
- FlagDefaultKind DefaultKind() const
- ABSL_EXCLUSIVE_LOCKS_REQUIRED(*DataGuard()) {
- return static_cast<FlagDefaultKind>(def_kind_);
+ FlagHelpKind HelpSourceKind() const {
+ return static_cast<FlagHelpKind>(help_source_kind_);
}
-
- // CommandLineFlag interface implementation
- absl::string_view Name() const override;
- std::string Filename() const override;
- std::string Help() const override;
- FlagFastTypeId TypeId() const override;
- bool IsSpecifiedOnCommandLine() const override
- ABSL_LOCKS_EXCLUDED(*DataGuard());
- std::string DefaultValue() const override ABSL_LOCKS_EXCLUDED(*DataGuard());
- std::string CurrentValue() const override ABSL_LOCKS_EXCLUDED(*DataGuard());
- bool ValidateInputValue(absl::string_view value) const override
- ABSL_LOCKS_EXCLUDED(*DataGuard());
- void CheckDefaultValueParsingRoundtrip() const override
- ABSL_LOCKS_EXCLUDED(*DataGuard());
+ FlagValueStorageKind ValueStorageKind() const {
+ return static_cast<FlagValueStorageKind>(value_storage_kind_);
+ }
+ FlagDefaultKind DefaultKind() const
+ ABSL_EXCLUSIVE_LOCKS_REQUIRED(*DataGuard()) {
+ return static_cast<FlagDefaultKind>(def_kind_);
+ }
+
+ // CommandLineFlag interface implementation
+ absl::string_view Name() const override;
+ std::string Filename() const override;
+ std::string Help() const override;
+ FlagFastTypeId TypeId() const override;
+ bool IsSpecifiedOnCommandLine() const override
+ ABSL_LOCKS_EXCLUDED(*DataGuard());
+ std::string DefaultValue() const override ABSL_LOCKS_EXCLUDED(*DataGuard());
+ std::string CurrentValue() const override ABSL_LOCKS_EXCLUDED(*DataGuard());
+ bool ValidateInputValue(absl::string_view value) const override
+ ABSL_LOCKS_EXCLUDED(*DataGuard());
+ void CheckDefaultValueParsingRoundtrip() const override
+ ABSL_LOCKS_EXCLUDED(*DataGuard());
int64_t ModificationCount() const ABSL_EXCLUSIVE_LOCKS_REQUIRED(*DataGuard());
- // Interfaces to save and restore flags to/from persistent state.
- // Returns current flag state or nullptr if flag does not support
- // saving and restoring a state.
- std::unique_ptr<FlagStateInterface> SaveState() override
- ABSL_LOCKS_EXCLUDED(*DataGuard());
-
- // Restores the flag state to the supplied state object. If there is
- // nothing to restore returns false. Otherwise returns true.
- bool RestoreState(const FlagState& flag_state)
- ABSL_LOCKS_EXCLUDED(*DataGuard());
-
- bool ParseFrom(absl::string_view value, FlagSettingMode set_mode,
- ValueSource source, std::string& error) override
- ABSL_LOCKS_EXCLUDED(*DataGuard());
-
- // Immutable flag's state.
-
- // Flags name passed to ABSL_FLAG as second arg.
- const char* const name_;
- // The file name where ABSL_FLAG resides.
- const char* const filename_;
- // Type-specific operations "vtable".
- const FlagOpFn op_;
- // Help message literal or function to generate it.
- const FlagHelpMsg help_;
+ // Interfaces to save and restore flags to/from persistent state.
+ // Returns current flag state or nullptr if flag does not support
+ // saving and restoring a state.
+ std::unique_ptr<FlagStateInterface> SaveState() override
+ ABSL_LOCKS_EXCLUDED(*DataGuard());
+
+ // Restores the flag state to the supplied state object. If there is
+ // nothing to restore returns false. Otherwise returns true.
+ bool RestoreState(const FlagState& flag_state)
+ ABSL_LOCKS_EXCLUDED(*DataGuard());
+
+ bool ParseFrom(absl::string_view value, FlagSettingMode set_mode,
+ ValueSource source, std::string& error) override
+ ABSL_LOCKS_EXCLUDED(*DataGuard());
+
+ // Immutable flag's state.
+
+ // Flags name passed to ABSL_FLAG as second arg.
+ const char* const name_;
+ // The file name where ABSL_FLAG resides.
+ const char* const filename_;
+ // Type-specific operations "vtable".
+ const FlagOpFn op_;
+ // Help message literal or function to generate it.
+ const FlagHelpMsg help_;
// Indicates if help message was supplied as literal or generator func.
- const uint8_t help_source_kind_ : 1;
- // Kind of storage this flag is using for the flag's value.
- const uint8_t value_storage_kind_ : 2;
-
- uint8_t : 0; // The bytes containing the const bitfields must not be
- // shared with bytes containing the mutable bitfields.
-
- // Mutable flag's state (guarded by `data_guard_`).
-
- // def_kind_ is not guard by DataGuard() since it is accessed in Init without
- // locks.
- uint8_t def_kind_ : 2;
- // Has this flag's value been modified?
- bool modified_ : 1 ABSL_GUARDED_BY(*DataGuard());
- // Has this flag been specified on command line.
- bool on_command_line_ : 1 ABSL_GUARDED_BY(*DataGuard());
-
- // Unique tag for absl::call_once call to initialize this flag.
- absl::once_flag init_control_;
-
+ const uint8_t help_source_kind_ : 1;
+ // Kind of storage this flag is using for the flag's value.
+ const uint8_t value_storage_kind_ : 2;
+
+ uint8_t : 0; // The bytes containing the const bitfields must not be
+ // shared with bytes containing the mutable bitfields.
+
+ // Mutable flag's state (guarded by `data_guard_`).
+
+ // def_kind_ is not guard by DataGuard() since it is accessed in Init without
+ // locks.
+ uint8_t def_kind_ : 2;
+ // Has this flag's value been modified?
+ bool modified_ : 1 ABSL_GUARDED_BY(*DataGuard());
+ // Has this flag been specified on command line.
+ bool on_command_line_ : 1 ABSL_GUARDED_BY(*DataGuard());
+
+ // Unique tag for absl::call_once call to initialize this flag.
+ absl::once_flag init_control_;
+
// Sequence lock / mutation counter.
flags_internal::SequenceLock seq_lock_;
- // Optional flag's callback and absl::Mutex to guard the invocations.
- FlagCallback* callback_ ABSL_GUARDED_BY(*DataGuard());
- // Either a pointer to the function generating the default value based on the
- // value specified in ABSL_FLAG or pointer to the dynamically set default
- // value via SetCommandLineOptionWithMode. def_kind_ is used to distinguish
- // these two cases.
- FlagDefaultSrc default_value_;
-
- // 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)];
+ // Optional flag's callback and absl::Mutex to guard the invocations.
+ FlagCallback* callback_ ABSL_GUARDED_BY(*DataGuard());
+ // Either a pointer to the function generating the default value based on the
+ // value specified in ABSL_FLAG or pointer to the dynamically set default
+ // value via SetCommandLineOptionWithMode. def_kind_ is used to distinguish
+ // these two cases.
+ FlagDefaultSrc default_value_;
+
+ // 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)];
};
-///////////////////////////////////////////////////////////////////////////////
-// The Flag object parameterized by the flag's value type. This class implements
-// flag reflection handle interface.
-
+///////////////////////////////////////////////////////////////////////////////
+// The Flag object parameterized by the flag's value type. This class implements
+// flag reflection handle interface.
+
template <typename T>
-class Flag {
+class Flag {
public:
- constexpr Flag(const char* name, const char* filename, FlagHelpArg help,
- const FlagDefaultArg default_arg)
- : impl_(name, filename, &FlagOps<T>, help,
- flags_internal::StorageKind<T>(), default_arg),
- value_() {}
-
- // CommandLineFlag interface
- absl::string_view Name() const { return impl_.Name(); }
- std::string Filename() const { return impl_.Filename(); }
- std::string Help() const { return impl_.Help(); }
- // Do not use. To be removed.
- bool IsSpecifiedOnCommandLine() const {
- return impl_.IsSpecifiedOnCommandLine();
- }
- std::string DefaultValue() const { return impl_.DefaultValue(); }
- std::string CurrentValue() const { return impl_.CurrentValue(); }
-
- private:
- template <typename, bool>
- friend class FlagRegistrar;
- friend class FlagImplPeer;
-
+ constexpr Flag(const char* name, const char* filename, FlagHelpArg help,
+ const FlagDefaultArg default_arg)
+ : impl_(name, filename, &FlagOps<T>, help,
+ flags_internal::StorageKind<T>(), default_arg),
+ value_() {}
+
+ // CommandLineFlag interface
+ absl::string_view Name() const { return impl_.Name(); }
+ std::string Filename() const { return impl_.Filename(); }
+ std::string Help() const { return impl_.Help(); }
+ // Do not use. To be removed.
+ bool IsSpecifiedOnCommandLine() const {
+ return impl_.IsSpecifiedOnCommandLine();
+ }
+ std::string DefaultValue() const { return impl_.DefaultValue(); }
+ std::string CurrentValue() const { return impl_.CurrentValue(); }
+
+ private:
+ template <typename, bool>
+ friend class FlagRegistrar;
+ friend class FlagImplPeer;
+
T Get() const {
// See implementation notes in CommandLineFlag::Get().
union U {
@@ -665,110 +665,110 @@ class Flag {
};
U u;
-#if !defined(NDEBUG)
- impl_.AssertValidType(base_internal::FastTypeId<T>(), &GenRuntimeTypeId<T>);
-#endif
-
+#if !defined(NDEBUG)
+ impl_.AssertValidType(base_internal::FastTypeId<T>(), &GenRuntimeTypeId<T>);
+#endif
+
if (ABSL_PREDICT_FALSE(!value_.Get(impl_.seq_lock_, u.value))) {
impl_.Read(&u.value);
}
return std::move(u.value);
}
- void Set(const T& v) {
- impl_.AssertValidType(base_internal::FastTypeId<T>(), &GenRuntimeTypeId<T>);
- impl_.Write(&v);
+ void Set(const T& v) {
+ impl_.AssertValidType(base_internal::FastTypeId<T>(), &GenRuntimeTypeId<T>);
+ impl_.Write(&v);
}
- // Access to the reflection.
- const CommandLineFlag& Reflect() const { return impl_; }
-
- // Flag's data
- // The implementation depends on value_ field to be placed exactly after the
- // impl_ field, so that impl_ can figure out the offset to the value and
- // access it.
- FlagImpl impl_;
- FlagValue<T> value_;
-};
-
-///////////////////////////////////////////////////////////////////////////////
-// Trampoline for friend access
-
-class FlagImplPeer {
- public:
- template <typename T, typename FlagType>
- static T InvokeGet(const FlagType& flag) {
- return flag.Get();
+ // Access to the reflection.
+ const CommandLineFlag& Reflect() const { return impl_; }
+
+ // Flag's data
+ // The implementation depends on value_ field to be placed exactly after the
+ // impl_ field, so that impl_ can figure out the offset to the value and
+ // access it.
+ FlagImpl impl_;
+ FlagValue<T> value_;
+};
+
+///////////////////////////////////////////////////////////////////////////////
+// Trampoline for friend access
+
+class FlagImplPeer {
+ public:
+ template <typename T, typename FlagType>
+ static T InvokeGet(const FlagType& flag) {
+ return flag.Get();
}
- template <typename FlagType, typename T>
- static void InvokeSet(FlagType& flag, const T& v) {
- flag.Set(v);
+ template <typename FlagType, typename T>
+ static void InvokeSet(FlagType& flag, const T& v) {
+ flag.Set(v);
}
- template <typename FlagType>
- static const CommandLineFlag& InvokeReflect(const FlagType& f) {
- return f.Reflect();
+ template <typename FlagType>
+ static const CommandLineFlag& InvokeReflect(const FlagType& f) {
+ return f.Reflect();
}
};
-///////////////////////////////////////////////////////////////////////////////
-// Implementation of Flag value specific operations routine.
+///////////////////////////////////////////////////////////////////////////////
+// Implementation of Flag value specific operations routine.
template <typename T>
-void* FlagOps(FlagOp op, const void* v1, void* v2, void* v3) {
- switch (op) {
- case FlagOp::kAlloc: {
- std::allocator<T> alloc;
- return std::allocator_traits<std::allocator<T>>::allocate(alloc, 1);
- }
- case FlagOp::kDelete: {
- T* p = static_cast<T*>(v2);
- p->~T();
- std::allocator<T> alloc;
- std::allocator_traits<std::allocator<T>>::deallocate(alloc, p, 1);
- return nullptr;
- }
- case FlagOp::kCopy:
- *static_cast<T*>(v2) = *static_cast<const T*>(v1);
- return nullptr;
- case FlagOp::kCopyConstruct:
- new (v2) T(*static_cast<const T*>(v1));
- return nullptr;
- case FlagOp::kSizeof:
- return reinterpret_cast<void*>(static_cast<uintptr_t>(sizeof(T)));
- case FlagOp::kFastTypeId:
- return const_cast<void*>(base_internal::FastTypeId<T>());
- case FlagOp::kRuntimeTypeId:
- return const_cast<std::type_info*>(GenRuntimeTypeId<T>());
- case FlagOp::kParse: {
- // Initialize the temporary instance of type T based on current value in
- // destination (which is going to be flag's default value).
- T temp(*static_cast<T*>(v2));
- if (!absl::ParseFlag<T>(*static_cast<const absl::string_view*>(v1), &temp,
- static_cast<std::string*>(v3))) {
- return nullptr;
- }
- *static_cast<T*>(v2) = std::move(temp);
- return v2;
- }
- case FlagOp::kUnparse:
- *static_cast<std::string*>(v2) =
- absl::UnparseFlag<T>(*static_cast<const T*>(v1));
- return nullptr;
- case FlagOp::kValueOffset: {
- // Round sizeof(FlagImp) to a multiple of alignof(FlagValue<T>) to get the
- // offset of the data.
- ptrdiff_t round_to = alignof(FlagValue<T>);
- ptrdiff_t offset =
- (sizeof(FlagImpl) + round_to - 1) / round_to * round_to;
- return reinterpret_cast<void*>(offset);
- }
+void* FlagOps(FlagOp op, const void* v1, void* v2, void* v3) {
+ switch (op) {
+ case FlagOp::kAlloc: {
+ std::allocator<T> alloc;
+ return std::allocator_traits<std::allocator<T>>::allocate(alloc, 1);
+ }
+ case FlagOp::kDelete: {
+ T* p = static_cast<T*>(v2);
+ p->~T();
+ std::allocator<T> alloc;
+ std::allocator_traits<std::allocator<T>>::deallocate(alloc, p, 1);
+ return nullptr;
+ }
+ case FlagOp::kCopy:
+ *static_cast<T*>(v2) = *static_cast<const T*>(v1);
+ return nullptr;
+ case FlagOp::kCopyConstruct:
+ new (v2) T(*static_cast<const T*>(v1));
+ return nullptr;
+ case FlagOp::kSizeof:
+ return reinterpret_cast<void*>(static_cast<uintptr_t>(sizeof(T)));
+ case FlagOp::kFastTypeId:
+ return const_cast<void*>(base_internal::FastTypeId<T>());
+ case FlagOp::kRuntimeTypeId:
+ return const_cast<std::type_info*>(GenRuntimeTypeId<T>());
+ case FlagOp::kParse: {
+ // Initialize the temporary instance of type T based on current value in
+ // destination (which is going to be flag's default value).
+ T temp(*static_cast<T*>(v2));
+ if (!absl::ParseFlag<T>(*static_cast<const absl::string_view*>(v1), &temp,
+ static_cast<std::string*>(v3))) {
+ return nullptr;
+ }
+ *static_cast<T*>(v2) = std::move(temp);
+ return v2;
+ }
+ case FlagOp::kUnparse:
+ *static_cast<std::string*>(v2) =
+ absl::UnparseFlag<T>(*static_cast<const T*>(v1));
+ return nullptr;
+ case FlagOp::kValueOffset: {
+ // Round sizeof(FlagImp) to a multiple of alignof(FlagValue<T>) to get the
+ // offset of the data.
+ ptrdiff_t round_to = alignof(FlagValue<T>);
+ ptrdiff_t offset =
+ (sizeof(FlagImpl) + round_to - 1) / round_to * round_to;
+ return reinterpret_cast<void*>(offset);
+ }
}
- return nullptr;
+ return nullptr;
}
-///////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
// This class facilitates Flag object registration and tail expression-based
// flag definition, for example:
// ABSL_FLAG(int, foo, 42, "Foo help").OnUpdate(NotifyFooWatcher);
-struct FlagRegistrarEmpty {};
+struct FlagRegistrarEmpty {};
template <typename T, bool do_register>
class FlagRegistrar {
public:
@@ -777,22 +777,22 @@ class FlagRegistrar {
flags_internal::RegisterCommandLineFlag(flag_.impl_, filename);
}
- FlagRegistrar OnUpdate(FlagCallbackFunc cb) && {
- flag_.impl_.SetCallback(cb);
+ FlagRegistrar OnUpdate(FlagCallbackFunc cb) && {
+ flag_.impl_.SetCallback(cb);
return *this;
}
- // Make the registrar "die" gracefully as an empty struct on a line where
- // registration happens. Registrar objects are intended to live only as
- // temporary.
- operator FlagRegistrarEmpty() const { return {}; } // NOLINT
+ // Make the registrar "die" gracefully as an empty struct on a line where
+ // registration happens. Registrar objects are intended to live only as
+ // temporary.
+ operator FlagRegistrarEmpty() const { return {}; } // NOLINT
private:
- Flag<T>& flag_; // Flag being registered (not owned).
+ Flag<T>& flag_; // Flag being registered (not owned).
};
} // namespace flags_internal
-ABSL_NAMESPACE_END
+ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_FLAGS_INTERNAL_FLAG_H_
diff --git a/contrib/restricted/abseil-cpp/absl/flags/internal/parse.h b/contrib/restricted/abseil-cpp/absl/flags/internal/parse.h
index de706c8984..1d99a287fc 100644
--- a/contrib/restricted/abseil-cpp/absl/flags/internal/parse.h
+++ b/contrib/restricted/abseil-cpp/absl/flags/internal/parse.h
@@ -19,9 +19,9 @@
#include <string>
#include <vector>
-#include "absl/base/config.h"
+#include "absl/base/config.h"
#include "absl/flags/declare.h"
-#include "absl/strings/string_view.h"
+#include "absl/strings/string_view.h"
ABSL_DECLARE_FLAG(std::vector<std::string>, flagfile);
ABSL_DECLARE_FLAG(std::vector<std::string>, fromenv);
@@ -29,7 +29,7 @@ ABSL_DECLARE_FLAG(std::vector<std::string>, tryfromenv);
ABSL_DECLARE_FLAG(std::vector<std::string>, undefok);
namespace absl {
-ABSL_NAMESPACE_BEGIN
+ABSL_NAMESPACE_BEGIN
namespace flags_internal {
enum class ArgvListAction { kRemoveParsedArgs, kKeepParsedArgs };
@@ -45,15 +45,15 @@ std::vector<char*> ParseCommandLineImpl(int argc, char* argv[],
UsageFlagsAction usage_flag_act,
OnUndefinedFlag on_undef_flag);
-// --------------------------------------------------------------------
-// Inspect original command line
-
-// Returns true if flag with specified name was either present on the original
-// command line or specified in flag file present on the original command line.
-bool WasPresentOnCommandLine(absl::string_view flag_name);
-
+// --------------------------------------------------------------------
+// Inspect original command line
+
+// Returns true if flag with specified name was either present on the original
+// command line or specified in flag file present on the original command line.
+bool WasPresentOnCommandLine(absl::string_view flag_name);
+
} // namespace flags_internal
-ABSL_NAMESPACE_END
+ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_FLAGS_INTERNAL_PARSE_H_
diff --git a/contrib/restricted/abseil-cpp/absl/flags/internal/path_util.h b/contrib/restricted/abseil-cpp/absl/flags/internal/path_util.h
index a6594d3347..60f6080f03 100644
--- a/contrib/restricted/abseil-cpp/absl/flags/internal/path_util.h
+++ b/contrib/restricted/abseil-cpp/absl/flags/internal/path_util.h
@@ -16,11 +16,11 @@
#ifndef ABSL_FLAGS_INTERNAL_PATH_UTIL_H_
#define ABSL_FLAGS_INTERNAL_PATH_UTIL_H_
-#include "absl/base/config.h"
+#include "absl/base/config.h"
#include "absl/strings/string_view.h"
namespace absl {
-ABSL_NAMESPACE_BEGIN
+ABSL_NAMESPACE_BEGIN
namespace flags_internal {
// A portable interface that returns the basename of the filename passed as an
@@ -56,7 +56,7 @@ inline absl::string_view Package(absl::string_view filename) {
}
} // namespace flags_internal
-ABSL_NAMESPACE_END
+ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_FLAGS_INTERNAL_PATH_UTIL_H_
diff --git a/contrib/restricted/abseil-cpp/absl/flags/internal/private_handle_accessor.cc b/contrib/restricted/abseil-cpp/absl/flags/internal/private_handle_accessor.cc
index a7eb58b6d4..b0f3f42fc6 100644
--- a/contrib/restricted/abseil-cpp/absl/flags/internal/private_handle_accessor.cc
+++ b/contrib/restricted/abseil-cpp/absl/flags/internal/private_handle_accessor.cc
@@ -1,65 +1,65 @@
-//
-// Copyright 2020 The Abseil Authors.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// https://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "absl/flags/internal/private_handle_accessor.h"
-
-#include <memory>
-#include <string>
-
-#include "absl/base/config.h"
-#include "absl/flags/commandlineflag.h"
-#include "absl/flags/internal/commandlineflag.h"
-#include "absl/strings/string_view.h"
-
-namespace absl {
-ABSL_NAMESPACE_BEGIN
-namespace flags_internal {
-
-FlagFastTypeId PrivateHandleAccessor::TypeId(const CommandLineFlag& flag) {
- return flag.TypeId();
-}
-
-std::unique_ptr<FlagStateInterface> PrivateHandleAccessor::SaveState(
- CommandLineFlag& flag) {
- return flag.SaveState();
-}
-
-bool PrivateHandleAccessor::IsSpecifiedOnCommandLine(
- const CommandLineFlag& flag) {
- return flag.IsSpecifiedOnCommandLine();
-}
-
-bool PrivateHandleAccessor::ValidateInputValue(const CommandLineFlag& flag,
- absl::string_view value) {
- return flag.ValidateInputValue(value);
-}
-
-void PrivateHandleAccessor::CheckDefaultValueParsingRoundtrip(
- const CommandLineFlag& flag) {
- flag.CheckDefaultValueParsingRoundtrip();
-}
-
-bool PrivateHandleAccessor::ParseFrom(CommandLineFlag& flag,
- absl::string_view value,
- flags_internal::FlagSettingMode set_mode,
- flags_internal::ValueSource source,
- std::string& error) {
- return flag.ParseFrom(value, set_mode, source, error);
-}
-
-} // namespace flags_internal
-ABSL_NAMESPACE_END
-} // namespace absl
-
+//
+// Copyright 2020 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#include "absl/flags/internal/private_handle_accessor.h"
+
+#include <memory>
+#include <string>
+
+#include "absl/base/config.h"
+#include "absl/flags/commandlineflag.h"
+#include "absl/flags/internal/commandlineflag.h"
+#include "absl/strings/string_view.h"
+
+namespace absl {
+ABSL_NAMESPACE_BEGIN
+namespace flags_internal {
+
+FlagFastTypeId PrivateHandleAccessor::TypeId(const CommandLineFlag& flag) {
+ return flag.TypeId();
+}
+
+std::unique_ptr<FlagStateInterface> PrivateHandleAccessor::SaveState(
+ CommandLineFlag& flag) {
+ return flag.SaveState();
+}
+
+bool PrivateHandleAccessor::IsSpecifiedOnCommandLine(
+ const CommandLineFlag& flag) {
+ return flag.IsSpecifiedOnCommandLine();
+}
+
+bool PrivateHandleAccessor::ValidateInputValue(const CommandLineFlag& flag,
+ absl::string_view value) {
+ return flag.ValidateInputValue(value);
+}
+
+void PrivateHandleAccessor::CheckDefaultValueParsingRoundtrip(
+ const CommandLineFlag& flag) {
+ flag.CheckDefaultValueParsingRoundtrip();
+}
+
+bool PrivateHandleAccessor::ParseFrom(CommandLineFlag& flag,
+ absl::string_view value,
+ flags_internal::FlagSettingMode set_mode,
+ flags_internal::ValueSource source,
+ std::string& error) {
+ return flag.ParseFrom(value, set_mode, source, error);
+}
+
+} // namespace flags_internal
+ABSL_NAMESPACE_END
+} // namespace absl
+
diff --git a/contrib/restricted/abseil-cpp/absl/flags/internal/private_handle_accessor.h b/contrib/restricted/abseil-cpp/absl/flags/internal/private_handle_accessor.h
index c64435cd61..67a9d0d5c9 100644
--- a/contrib/restricted/abseil-cpp/absl/flags/internal/private_handle_accessor.h
+++ b/contrib/restricted/abseil-cpp/absl/flags/internal/private_handle_accessor.h
@@ -1,61 +1,61 @@
-//
-// Copyright 2020 The Abseil Authors.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// https://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef ABSL_FLAGS_INTERNAL_PRIVATE_HANDLE_ACCESSOR_H_
-#define ABSL_FLAGS_INTERNAL_PRIVATE_HANDLE_ACCESSOR_H_
-
-#include <memory>
-#include <string>
-
-#include "absl/base/config.h"
-#include "absl/flags/commandlineflag.h"
-#include "absl/flags/internal/commandlineflag.h"
-#include "absl/strings/string_view.h"
-
-namespace absl {
-ABSL_NAMESPACE_BEGIN
-namespace flags_internal {
-
-// This class serves as a trampoline to access private methods of
-// CommandLineFlag. This class is intended for use exclusively internally inside
-// of the Abseil Flags implementation.
-class PrivateHandleAccessor {
- public:
- // Access to CommandLineFlag::TypeId.
- static FlagFastTypeId TypeId(const CommandLineFlag& flag);
-
- // Access to CommandLineFlag::SaveState.
- static std::unique_ptr<FlagStateInterface> SaveState(CommandLineFlag& flag);
-
- // Access to CommandLineFlag::IsSpecifiedOnCommandLine.
- static bool IsSpecifiedOnCommandLine(const CommandLineFlag& flag);
-
- // Access to CommandLineFlag::ValidateInputValue.
- static bool ValidateInputValue(const CommandLineFlag& flag,
- absl::string_view value);
-
- // Access to CommandLineFlag::CheckDefaultValueParsingRoundtrip.
- static void CheckDefaultValueParsingRoundtrip(const CommandLineFlag& flag);
-
- static bool ParseFrom(CommandLineFlag& flag, absl::string_view value,
- flags_internal::FlagSettingMode set_mode,
- flags_internal::ValueSource source, std::string& error);
-};
-
-} // namespace flags_internal
-ABSL_NAMESPACE_END
-} // namespace absl
-
-#endif // ABSL_FLAGS_INTERNAL_PRIVATE_HANDLE_ACCESSOR_H_
+//
+// Copyright 2020 The Abseil Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef ABSL_FLAGS_INTERNAL_PRIVATE_HANDLE_ACCESSOR_H_
+#define ABSL_FLAGS_INTERNAL_PRIVATE_HANDLE_ACCESSOR_H_
+
+#include <memory>
+#include <string>
+
+#include "absl/base/config.h"
+#include "absl/flags/commandlineflag.h"
+#include "absl/flags/internal/commandlineflag.h"
+#include "absl/strings/string_view.h"
+
+namespace absl {
+ABSL_NAMESPACE_BEGIN
+namespace flags_internal {
+
+// This class serves as a trampoline to access private methods of
+// CommandLineFlag. This class is intended for use exclusively internally inside
+// of the Abseil Flags implementation.
+class PrivateHandleAccessor {
+ public:
+ // Access to CommandLineFlag::TypeId.
+ static FlagFastTypeId TypeId(const CommandLineFlag& flag);
+
+ // Access to CommandLineFlag::SaveState.
+ static std::unique_ptr<FlagStateInterface> SaveState(CommandLineFlag& flag);
+
+ // Access to CommandLineFlag::IsSpecifiedOnCommandLine.
+ static bool IsSpecifiedOnCommandLine(const CommandLineFlag& flag);
+
+ // Access to CommandLineFlag::ValidateInputValue.
+ static bool ValidateInputValue(const CommandLineFlag& flag,
+ absl::string_view value);
+
+ // Access to CommandLineFlag::CheckDefaultValueParsingRoundtrip.
+ static void CheckDefaultValueParsingRoundtrip(const CommandLineFlag& flag);
+
+ static bool ParseFrom(CommandLineFlag& flag, absl::string_view value,
+ flags_internal::FlagSettingMode set_mode,
+ flags_internal::ValueSource source, std::string& error);
+};
+
+} // namespace flags_internal
+ABSL_NAMESPACE_END
+} // namespace absl
+
+#endif // ABSL_FLAGS_INTERNAL_PRIVATE_HANDLE_ACCESSOR_H_
diff --git a/contrib/restricted/abseil-cpp/absl/flags/internal/private_handle_accessor/ya.make b/contrib/restricted/abseil-cpp/absl/flags/internal/private_handle_accessor/ya.make
index 80a55d0f76..962c786fba 100644
--- a/contrib/restricted/abseil-cpp/absl/flags/internal/private_handle_accessor/ya.make
+++ b/contrib/restricted/abseil-cpp/absl/flags/internal/private_handle_accessor/ya.make
@@ -30,10 +30,10 @@ NO_COMPILER_WARNINGS()
NO_UTIL()
-CFLAGS(
- -DNOMINMAX
-)
-
+CFLAGS(
+ -DNOMINMAX
+)
+
SRCDIR(contrib/restricted/abseil-cpp/absl/flags/internal)
SRCS(
diff --git a/contrib/restricted/abseil-cpp/absl/flags/internal/program_name.cc b/contrib/restricted/abseil-cpp/absl/flags/internal/program_name.cc
index 51d698da8b..84e1d84d67 100644
--- a/contrib/restricted/abseil-cpp/absl/flags/internal/program_name.cc
+++ b/contrib/restricted/abseil-cpp/absl/flags/internal/program_name.cc
@@ -17,16 +17,16 @@
#include <string>
-#include "absl/base/attributes.h"
-#include "absl/base/config.h"
-#include "absl/base/const_init.h"
-#include "absl/base/thread_annotations.h"
+#include "absl/base/attributes.h"
+#include "absl/base/config.h"
+#include "absl/base/const_init.h"
+#include "absl/base/thread_annotations.h"
#include "absl/flags/internal/path_util.h"
-#include "absl/strings/string_view.h"
+#include "absl/strings/string_view.h"
#include "absl/synchronization/mutex.h"
namespace absl {
-ABSL_NAMESPACE_BEGIN
+ABSL_NAMESPACE_BEGIN
namespace flags_internal {
ABSL_CONST_INIT static absl::Mutex program_name_guard(absl::kConstInit);
@@ -56,5 +56,5 @@ void SetProgramInvocationName(absl::string_view prog_name_str) {
}
} // namespace flags_internal
-ABSL_NAMESPACE_END
+ABSL_NAMESPACE_END
} // namespace absl
diff --git a/contrib/restricted/abseil-cpp/absl/flags/internal/program_name.h b/contrib/restricted/abseil-cpp/absl/flags/internal/program_name.h
index b99b94fe18..4a3821ec79 100644
--- a/contrib/restricted/abseil-cpp/absl/flags/internal/program_name.h
+++ b/contrib/restricted/abseil-cpp/absl/flags/internal/program_name.h
@@ -18,14 +18,14 @@
#include <string>
-#include "absl/base/config.h"
+#include "absl/base/config.h"
#include "absl/strings/string_view.h"
// --------------------------------------------------------------------
// Program name
namespace absl {
-ABSL_NAMESPACE_BEGIN
+ABSL_NAMESPACE_BEGIN
namespace flags_internal {
// Returns program invocation name or "UNKNOWN" if `SetProgramInvocationName()`
@@ -44,7 +44,7 @@ std::string ShortProgramInvocationName();
void SetProgramInvocationName(absl::string_view prog_name_str);
} // namespace flags_internal
-ABSL_NAMESPACE_END
+ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_FLAGS_INTERNAL_PROGRAM_NAME_H_
diff --git a/contrib/restricted/abseil-cpp/absl/flags/internal/program_name/ya.make b/contrib/restricted/abseil-cpp/absl/flags/internal/program_name/ya.make
index 701fef73c0..1f41129e97 100644
--- a/contrib/restricted/abseil-cpp/absl/flags/internal/program_name/ya.make
+++ b/contrib/restricted/abseil-cpp/absl/flags/internal/program_name/ya.make
@@ -37,10 +37,10 @@ NO_COMPILER_WARNINGS()
NO_UTIL()
-CFLAGS(
- -DNOMINMAX
-)
-
+CFLAGS(
+ -DNOMINMAX
+)
+
SRCDIR(contrib/restricted/abseil-cpp/absl/flags/internal)
SRCS(
diff --git a/contrib/restricted/abseil-cpp/absl/flags/internal/registry.h b/contrib/restricted/abseil-cpp/absl/flags/internal/registry.h
index 4b68c85f5c..de075a5195 100644
--- a/contrib/restricted/abseil-cpp/absl/flags/internal/registry.h
+++ b/contrib/restricted/abseil-cpp/absl/flags/internal/registry.h
@@ -18,28 +18,28 @@
#include <functional>
-#include "absl/base/config.h"
-#include "absl/flags/commandlineflag.h"
+#include "absl/base/config.h"
+#include "absl/flags/commandlineflag.h"
#include "absl/flags/internal/commandlineflag.h"
-#include "absl/strings/string_view.h"
+#include "absl/strings/string_view.h"
// --------------------------------------------------------------------
// Global flags registry API.
namespace absl {
-ABSL_NAMESPACE_BEGIN
+ABSL_NAMESPACE_BEGIN
namespace flags_internal {
// Executes specified visitor for each non-retired flag in the registry. While
// callback are executed, the registry is locked and can't be changed.
-void ForEachFlag(std::function<void(CommandLineFlag&)> visitor);
+void ForEachFlag(std::function<void(CommandLineFlag&)> visitor);
//-----------------------------------------------------------------------------
bool RegisterCommandLineFlag(CommandLineFlag&, const char* filename);
-void FinalizeRegistry();
-
+void FinalizeRegistry();
+
//-----------------------------------------------------------------------------
// Retired registrations:
//
@@ -73,25 +73,25 @@ void FinalizeRegistry();
//
// Retire flag with name "name" and type indicated by ops.
-void Retire(const char* name, FlagFastTypeId type_id, char* buf);
-
-constexpr size_t kRetiredFlagObjSize = 3 * sizeof(void*);
-constexpr size_t kRetiredFlagObjAlignment = alignof(void*);
+void Retire(const char* name, FlagFastTypeId type_id, char* buf);
+constexpr size_t kRetiredFlagObjSize = 3 * sizeof(void*);
+constexpr size_t kRetiredFlagObjAlignment = alignof(void*);
+
// Registered a retired flag with name 'flag_name' and type 'T'.
template <typename T>
-class RetiredFlag {
+class RetiredFlag {
public:
- void Retire(const char* flag_name) {
- flags_internal::Retire(flag_name, base_internal::FastTypeId<T>(), buf_);
- }
+ void Retire(const char* flag_name) {
+ flags_internal::Retire(flag_name, base_internal::FastTypeId<T>(), buf_);
+ }
private:
- alignas(kRetiredFlagObjAlignment) char buf_[kRetiredFlagObjSize];
+ alignas(kRetiredFlagObjAlignment) char buf_[kRetiredFlagObjSize];
};
} // namespace flags_internal
-ABSL_NAMESPACE_END
+ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_FLAGS_INTERNAL_REGISTRY_H_
diff --git a/contrib/restricted/abseil-cpp/absl/flags/internal/usage.cc b/contrib/restricted/abseil-cpp/absl/flags/internal/usage.cc
index 949709e883..3448d2688a 100644
--- a/contrib/restricted/abseil-cpp/absl/flags/internal/usage.cc
+++ b/contrib/restricted/abseil-cpp/absl/flags/internal/usage.cc
@@ -15,23 +15,23 @@
#include "absl/flags/internal/usage.h"
-#include <stdint.h>
-
-#include <functional>
+#include <stdint.h>
+
+#include <functional>
#include <map>
-#include <ostream>
+#include <ostream>
#include <string>
-#include <utility>
-#include <vector>
+#include <utility>
+#include <vector>
-#include "absl/base/config.h"
-#include "absl/flags/commandlineflag.h"
+#include "absl/base/config.h"
+#include "absl/flags/commandlineflag.h"
#include "absl/flags/flag.h"
-#include "absl/flags/internal/flag.h"
+#include "absl/flags/internal/flag.h"
#include "absl/flags/internal/path_util.h"
-#include "absl/flags/internal/private_handle_accessor.h"
+#include "absl/flags/internal/private_handle_accessor.h"
#include "absl/flags/internal/program_name.h"
-#include "absl/flags/internal/registry.h"
+#include "absl/flags/internal/registry.h"
#include "absl/flags/usage_config.h"
#include "absl/strings/str_cat.h"
#include "absl/strings/str_split.h"
@@ -48,7 +48,7 @@ bool FLAGS_helpon = false;
bool FLAGS_helpmatch = false;
namespace absl {
-ABSL_NAMESPACE_BEGIN
+ABSL_NAMESPACE_BEGIN
namespace flags_internal {
namespace {
@@ -111,7 +111,7 @@ class FlagHelpPrettyPrinter {
// to that stream.
FlagHelpPrettyPrinter(size_t max_line_len, size_t min_line_len,
size_t wrapped_line_indent, std::ostream& out)
- : out_(out),
+ : out_(out),
max_line_len_(max_line_len),
min_line_len_(min_line_len),
wrapped_line_indent_(wrapped_line_indent),
@@ -119,14 +119,14 @@ class FlagHelpPrettyPrinter {
first_line_(true) {}
void Write(absl::string_view str, bool wrap_line = false) {
- // Empty string - do nothing.
+ // Empty string - do nothing.
if (str.empty()) return;
std::vector<absl::string_view> tokens;
if (wrap_line) {
for (auto line : absl::StrSplit(str, absl::ByAnyChar("\n\r"))) {
if (!tokens.empty()) {
- // Keep line separators in the input string.
+ // Keep line separators in the input string.
tokens.push_back("\n");
}
for (auto token :
@@ -141,15 +141,15 @@ class FlagHelpPrettyPrinter {
for (auto token : tokens) {
bool new_line = (line_len_ == 0);
- // Respect line separators in the input string.
+ // Respect line separators in the input string.
if (token == "\n") {
EndLine();
continue;
}
- // Write the token, ending the string first if necessary/possible.
- if (!new_line &&
- (line_len_ + static_cast<int>(token.size()) >= max_line_len_)) {
+ // Write the token, ending the string first if necessary/possible.
+ if (!new_line &&
+ (line_len_ + static_cast<int>(token.size()) >= max_line_len_)) {
EndLine();
new_line = true;
}
@@ -189,11 +189,11 @@ class FlagHelpPrettyPrinter {
bool first_line_;
};
-void FlagHelpHumanReadable(const CommandLineFlag& flag, std::ostream& out) {
+void FlagHelpHumanReadable(const CommandLineFlag& flag, std::ostream& out) {
FlagHelpPrettyPrinter printer(kHrfMaxLineLength, 4, 2, out);
// Flag name.
- printer.Write(absl::StrCat("--", flag.Name()));
+ printer.Write(absl::StrCat("--", flag.Name()));
// Flag help.
printer.Write(absl::StrCat("(", flag.Help(), ");"), /*wrap_line=*/true);
@@ -203,15 +203,15 @@ void FlagHelpHumanReadable(const CommandLineFlag& flag, std::ostream& out) {
// subsequently been modified using SetCommandLineOption() with mode
// SET_FLAGS_DEFAULT.
std::string dflt_val = flag.DefaultValue();
- std::string curr_val = flag.CurrentValue();
- bool is_modified = curr_val != dflt_val;
-
+ std::string curr_val = flag.CurrentValue();
+ bool is_modified = curr_val != dflt_val;
+
if (flag.IsOfType<std::string>()) {
dflt_val = absl::StrCat("\"", dflt_val, "\"");
}
printer.Write(absl::StrCat("default: ", dflt_val, ";"));
- if (is_modified) {
+ if (is_modified) {
if (flag.IsOfType<std::string>()) {
curr_val = absl::StrCat("\"", curr_val, "\"");
}
@@ -251,28 +251,28 @@ void FlagsHelpImpl(std::ostream& out, PerFlagFilter filter_cb,
// This map is used to output matching flags grouped by package and file
// name.
std::map<std::string,
- std::map<std::string, std::vector<const absl::CommandLineFlag*>>>
+ std::map<std::string, std::vector<const absl::CommandLineFlag*>>>
matching_flags;
- flags_internal::ForEachFlag([&](absl::CommandLineFlag& flag) {
+ flags_internal::ForEachFlag([&](absl::CommandLineFlag& flag) {
// Ignore retired flags.
- if (flag.IsRetired()) return;
+ if (flag.IsRetired()) return;
// If the flag has been stripped, pretend that it doesn't exist.
- if (flag.Help() == flags_internal::kStrippedFlagHelp) return;
+ if (flag.Help() == flags_internal::kStrippedFlagHelp) return;
// Make sure flag satisfies the filter
if (!filter_cb(flag)) return;
- std::string flag_filename = flag.Filename();
-
+ std::string flag_filename = flag.Filename();
+
matching_flags[std::string(flags_internal::Package(flag_filename))]
[flag_filename]
- .push_back(&flag);
+ .push_back(&flag);
});
- absl::string_view package_separator; // controls blank lines between packages
- absl::string_view file_separator; // controls blank lines between files
+ absl::string_view package_separator; // controls blank lines between packages
+ absl::string_view file_separator; // controls blank lines between files
for (auto& package : matching_flags) {
if (format == HelpFormat::kHumanReadable) {
out << package_separator;
@@ -332,10 +332,10 @@ void FlagsHelpImpl(std::ostream& out,
// --------------------------------------------------------------------
// Produces the help message describing specific flag.
-void FlagHelp(std::ostream& out, const CommandLineFlag& flag,
+void FlagHelp(std::ostream& out, const CommandLineFlag& flag,
HelpFormat format) {
if (format == HelpFormat::kHumanReadable)
- flags_internal::FlagHelpHumanReadable(flag, out);
+ flags_internal::FlagHelpHumanReadable(flag, out);
}
// --------------------------------------------------------------------
@@ -520,5 +520,5 @@ bool DeduceUsageFlags(absl::string_view name, absl::string_view value) {
}
} // namespace flags_internal
-ABSL_NAMESPACE_END
+ABSL_NAMESPACE_END
} // namespace absl
diff --git a/contrib/restricted/abseil-cpp/absl/flags/internal/usage.h b/contrib/restricted/abseil-cpp/absl/flags/internal/usage.h
index c0bcac5762..856bdf2e04 100644
--- a/contrib/restricted/abseil-cpp/absl/flags/internal/usage.h
+++ b/contrib/restricted/abseil-cpp/absl/flags/internal/usage.h
@@ -19,8 +19,8 @@
#include <iosfwd>
#include <string>
-#include "absl/base/config.h"
-#include "absl/flags/commandlineflag.h"
+#include "absl/base/config.h"
+#include "absl/flags/commandlineflag.h"
#include "absl/flags/declare.h"
#include "absl/strings/string_view.h"
@@ -28,7 +28,7 @@
// Usage reporting interfaces
namespace absl {
-ABSL_NAMESPACE_BEGIN
+ABSL_NAMESPACE_BEGIN
namespace flags_internal {
// The format to report the help messages in.
@@ -36,9 +36,9 @@ enum class HelpFormat {
kHumanReadable,
};
-// Streams the help message describing `flag` to `out`.
-// The default value for `flag` is included in the output.
-void FlagHelp(std::ostream& out, const CommandLineFlag& flag,
+// Streams the help message describing `flag` to `out`.
+// The default value for `flag` is included in the output.
+void FlagHelp(std::ostream& out, const CommandLineFlag& flag,
HelpFormat format = HelpFormat::kHumanReadable);
// Produces the help messages for all flags matching the filter. A flag matches
@@ -98,7 +98,7 @@ void SetFlagsHelpFormat(HelpFormat);
bool DeduceUsageFlags(absl::string_view name, absl::string_view value);
} // namespace flags_internal
-ABSL_NAMESPACE_END
+ABSL_NAMESPACE_END
} // namespace absl
#endif // ABSL_FLAGS_INTERNAL_USAGE_H_
diff --git a/contrib/restricted/abseil-cpp/absl/flags/internal/usage/ya.make b/contrib/restricted/abseil-cpp/absl/flags/internal/usage/ya.make
index 358744df59..22a9226f4c 100644
--- a/contrib/restricted/abseil-cpp/absl/flags/internal/usage/ya.make
+++ b/contrib/restricted/abseil-cpp/absl/flags/internal/usage/ya.make
@@ -1,20 +1,20 @@
-# Generated by devtools/yamaker.
-
-LIBRARY()
-
+# Generated by devtools/yamaker.
+
+LIBRARY()
+
WITHOUT_LICENSE_TEXTS()
-OWNER(g:cpp-contrib)
-
-LICENSE(Apache-2.0)
-
-PEERDIR(
- contrib/restricted/abseil-cpp/absl/base
+OWNER(g:cpp-contrib)
+
+LICENSE(Apache-2.0)
+
+PEERDIR(
+ contrib/restricted/abseil-cpp/absl/base
contrib/restricted/abseil-cpp/absl/base/internal/low_level_alloc
- contrib/restricted/abseil-cpp/absl/base/internal/raw_logging
- contrib/restricted/abseil-cpp/absl/base/internal/spinlock_wait
- contrib/restricted/abseil-cpp/absl/base/internal/throw_delegate
- contrib/restricted/abseil-cpp/absl/base/log_severity
+ contrib/restricted/abseil-cpp/absl/base/internal/raw_logging
+ contrib/restricted/abseil-cpp/absl/base/internal/spinlock_wait
+ contrib/restricted/abseil-cpp/absl/base/internal/throw_delegate
+ contrib/restricted/abseil-cpp/absl/base/log_severity
contrib/restricted/abseil-cpp/absl/city
contrib/restricted/abseil-cpp/absl/container/internal/absl_hashtablez_sampler
contrib/restricted/abseil-cpp/absl/container/internal/raw_hash_set
@@ -33,9 +33,9 @@ PEERDIR(
contrib/restricted/abseil-cpp/absl/flags/usage_config
contrib/restricted/abseil-cpp/absl/hash
contrib/restricted/abseil-cpp/absl/hash/internal
- contrib/restricted/abseil-cpp/absl/numeric
+ contrib/restricted/abseil-cpp/absl/numeric
contrib/restricted/abseil-cpp/absl/profiling/internal/exponential_biased
- contrib/restricted/abseil-cpp/absl/strings
+ contrib/restricted/abseil-cpp/absl/strings
contrib/restricted/abseil-cpp/absl/strings/cord
contrib/restricted/abseil-cpp/absl/strings/internal/absl_cord_internal
contrib/restricted/abseil-cpp/absl/strings/internal/absl_strings_internal
@@ -49,25 +49,25 @@ PEERDIR(
contrib/restricted/abseil-cpp/absl/time/civil_time
contrib/restricted/abseil-cpp/absl/time/time_zone
contrib/restricted/abseil-cpp/absl/types/bad_optional_access
- contrib/restricted/abseil-cpp/absl/types/bad_variant_access
-)
-
-ADDINCL(
- GLOBAL contrib/restricted/abseil-cpp
-)
-
-NO_COMPILER_WARNINGS()
-
-NO_UTIL()
-
-CFLAGS(
- -DNOMINMAX
-)
-
+ contrib/restricted/abseil-cpp/absl/types/bad_variant_access
+)
+
+ADDINCL(
+ GLOBAL contrib/restricted/abseil-cpp
+)
+
+NO_COMPILER_WARNINGS()
+
+NO_UTIL()
+
+CFLAGS(
+ -DNOMINMAX
+)
+
SRCDIR(contrib/restricted/abseil-cpp/absl/flags/internal)
-
-SRCS(
+
+SRCS(
usage.cc
-)
-
-END()
+)
+
+END()