aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/restricted/abseil-cpp/absl/flags
diff options
context:
space:
mode:
authorprime <prime@yandex-team.ru>2022-02-10 16:46:00 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:00 +0300
commit3695a7cd42b74a4987d8d5a8f2e2443556998943 (patch)
treeee79ee9294a61ee00e647684b3700d0a87e102a3 /contrib/restricted/abseil-cpp/absl/flags
parent4d8b546b89b5afc08cf3667e176271c7ba935f33 (diff)
downloadydb-3695a7cd42b74a4987d8d5a8f2e2443556998943.tar.gz
Restoring authorship annotation for <prime@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/restricted/abseil-cpp/absl/flags')
-rw-r--r--contrib/restricted/abseil-cpp/absl/flags/commandlineflag/ya.make72
-rw-r--r--contrib/restricted/abseil-cpp/absl/flags/flag.h12
-rw-r--r--contrib/restricted/abseil-cpp/absl/flags/internal/commandlineflag.h2
-rw-r--r--contrib/restricted/abseil-cpp/absl/flags/internal/flag.cc98
-rw-r--r--contrib/restricted/abseil-cpp/absl/flags/internal/flag.h78
-rw-r--r--contrib/restricted/abseil-cpp/absl/flags/internal/flag/ya.make72
-rw-r--r--contrib/restricted/abseil-cpp/absl/flags/internal/registry.h2
-rw-r--r--contrib/restricted/abseil-cpp/absl/flags/internal/sequence_lock.h372
-rw-r--r--contrib/restricted/abseil-cpp/absl/flags/internal/usage.cc412
-rw-r--r--contrib/restricted/abseil-cpp/absl/flags/internal/usage.h62
-rw-r--r--contrib/restricted/abseil-cpp/absl/flags/internal/usage/ya.make14
-rw-r--r--contrib/restricted/abseil-cpp/absl/flags/marshalling.h4
-rw-r--r--contrib/restricted/abseil-cpp/absl/flags/marshalling/ya.make70
-rw-r--r--contrib/restricted/abseil-cpp/absl/flags/parse.cc10
-rw-r--r--contrib/restricted/abseil-cpp/absl/flags/reflection.cc38
-rw-r--r--contrib/restricted/abseil-cpp/absl/flags/reflection.h2
-rw-r--r--contrib/restricted/abseil-cpp/absl/flags/reflection/ya.make12
-rw-r--r--contrib/restricted/abseil-cpp/absl/flags/usage/ya.make2
-rw-r--r--contrib/restricted/abseil-cpp/absl/flags/usage_config.cc6
-rw-r--r--contrib/restricted/abseil-cpp/absl/flags/usage_config.h4
-rw-r--r--contrib/restricted/abseil-cpp/absl/flags/ya.make70
21 files changed, 707 insertions, 707 deletions
diff --git a/contrib/restricted/abseil-cpp/absl/flags/commandlineflag/ya.make b/contrib/restricted/abseil-cpp/absl/flags/commandlineflag/ya.make
index 4eef7c0237..71191a2d72 100644
--- a/contrib/restricted/abseil-cpp/absl/flags/commandlineflag/ya.make
+++ b/contrib/restricted/abseil-cpp/absl/flags/commandlineflag/ya.make
@@ -1,42 +1,42 @@
-# 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
- 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
+OWNER(g:cpp-contrib)
+
+LICENSE(Apache-2.0)
+
+PEERDIR(
+ contrib/restricted/abseil-cpp/absl/base
+ 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/flags/internal/commandlineflag
- contrib/restricted/abseil-cpp/absl/numeric
- contrib/restricted/abseil-cpp/absl/strings
+ contrib/restricted/abseil-cpp/absl/numeric
+ contrib/restricted/abseil-cpp/absl/strings
contrib/restricted/abseil-cpp/absl/strings/internal/absl_strings_internal
- contrib/restricted/abseil-cpp/absl/types/bad_optional_access
-)
-
-ADDINCL(
- GLOBAL contrib/restricted/abseil-cpp
-)
-
-NO_COMPILER_WARNINGS()
-
-NO_UTIL()
-
-CFLAGS(
- -DNOMINMAX
-)
-
+ contrib/restricted/abseil-cpp/absl/types/bad_optional_access
+)
+
+ADDINCL(
+ GLOBAL contrib/restricted/abseil-cpp
+)
+
+NO_COMPILER_WARNINGS()
+
+NO_UTIL()
+
+CFLAGS(
+ -DNOMINMAX
+)
+
SRCDIR(contrib/restricted/abseil-cpp/absl/flags)
-
-SRCS(
+
+SRCS(
commandlineflag.cc
-)
-
-END()
+)
+
+END()
diff --git a/contrib/restricted/abseil-cpp/absl/flags/flag.h b/contrib/restricted/abseil-cpp/absl/flags/flag.h
index a724ccc97d..64f6013d20 100644
--- a/contrib/restricted/abseil-cpp/absl/flags/flag.h
+++ b/contrib/restricted/abseil-cpp/absl/flags/flag.h
@@ -208,15 +208,15 @@ ABSL_NAMESPACE_END
#if ABSL_FLAGS_STRIP_NAMES
#define ABSL_FLAG_IMPL_FLAGNAME(txt) ""
#define ABSL_FLAG_IMPL_FILENAME() ""
-#define ABSL_FLAG_IMPL_REGISTRAR(T, flag) \
- absl::flags_internal::FlagRegistrar<T, false>(ABSL_FLAG_IMPL_FLAG_PTR(flag), \
- nullptr)
+#define ABSL_FLAG_IMPL_REGISTRAR(T, flag) \
+ absl::flags_internal::FlagRegistrar<T, false>(ABSL_FLAG_IMPL_FLAG_PTR(flag), \
+ nullptr)
#else
#define ABSL_FLAG_IMPL_FLAGNAME(txt) txt
#define ABSL_FLAG_IMPL_FILENAME() __FILE__
-#define ABSL_FLAG_IMPL_REGISTRAR(T, flag) \
- absl::flags_internal::FlagRegistrar<T, true>(ABSL_FLAG_IMPL_FLAG_PTR(flag), \
- __FILE__)
+#define ABSL_FLAG_IMPL_REGISTRAR(T, flag) \
+ absl::flags_internal::FlagRegistrar<T, true>(ABSL_FLAG_IMPL_FLAG_PTR(flag), \
+ __FILE__)
#endif
// ABSL_FLAG_IMPL macro definition conditional on ABSL_FLAGS_STRIP_HELP
diff --git a/contrib/restricted/abseil-cpp/absl/flags/internal/commandlineflag.h b/contrib/restricted/abseil-cpp/absl/flags/internal/commandlineflag.h
index ebfe81ba1e..ddb0e9cd00 100644
--- a/contrib/restricted/abseil-cpp/absl/flags/internal/commandlineflag.h
+++ b/contrib/restricted/abseil-cpp/absl/flags/internal/commandlineflag.h
@@ -24,7 +24,7 @@ ABSL_NAMESPACE_BEGIN
namespace flags_internal {
// 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
+// 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.
diff --git a/contrib/restricted/abseil-cpp/absl/flags/internal/flag.cc b/contrib/restricted/abseil-cpp/absl/flags/internal/flag.cc
index 1515022d11..20e1e8cd71 100644
--- a/contrib/restricted/abseil-cpp/absl/flags/internal/flag.cc
+++ b/contrib/restricted/abseil-cpp/absl/flags/internal/flag.cc
@@ -96,8 +96,8 @@ class FlagState : public flags_internal::FlagStateInterface {
counter_(counter) {}
~FlagState() override {
- if (flag_impl_.ValueStorageKind() != FlagValueStorageKind::kAlignedBuffer &&
- flag_impl_.ValueStorageKind() != FlagValueStorageKind::kSequenceLocked)
+ if (flag_impl_.ValueStorageKind() != FlagValueStorageKind::kAlignedBuffer &&
+ flag_impl_.ValueStorageKind() != FlagValueStorageKind::kSequenceLocked)
return;
flags_internal::Delete(flag_impl_.op_, value_.heap_allocated);
}
@@ -164,11 +164,11 @@ void FlagImpl::Init() {
std::memory_order_release);
break;
}
- case FlagValueStorageKind::kSequenceLocked: {
+ case FlagValueStorageKind::kSequenceLocked: {
// For this storage kind the default_value_ always points to gen_func
// during initialization.
assert(def_kind == FlagDefaultKind::kGenFunc);
- (*default_value_.gen_func)(AtomicBufferValue());
+ (*default_value_.gen_func)(AtomicBufferValue());
break;
}
case FlagValueStorageKind::kAlignedBuffer:
@@ -178,7 +178,7 @@ void FlagImpl::Init() {
(*default_value_.gen_func)(AlignedBufferValue());
break;
}
- seq_lock_.MarkInitialized();
+ seq_lock_.MarkInitialized();
}
absl::Mutex* FlagImpl::DataGuard() const {
@@ -239,11 +239,11 @@ void FlagImpl::StoreValue(const void* src) {
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);
- seq_lock_.IncrementModificationCount();
+ seq_lock_.IncrementModificationCount();
break;
}
- case FlagValueStorageKind::kSequenceLocked: {
- seq_lock_.Write(AtomicBufferValue(), src, Sizeof(op_));
+ case FlagValueStorageKind::kSequenceLocked: {
+ seq_lock_.Write(AtomicBufferValue(), src, Sizeof(op_));
break;
}
case FlagValueStorageKind::kAlignedBuffer:
@@ -270,10 +270,10 @@ FlagFastTypeId FlagImpl::TypeId() const {
return flags_internal::FastTypeId(op_);
}
-int64_t FlagImpl::ModificationCount() const {
- return seq_lock_.ModificationCount();
-}
-
+int64_t FlagImpl::ModificationCount() const {
+ return seq_lock_.ModificationCount();
+}
+
bool FlagImpl::IsSpecifiedOnCommandLine() const {
absl::MutexLock l(DataGuard());
return on_command_line_;
@@ -296,11 +296,11 @@ std::string FlagImpl::CurrentValue() const {
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::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);
@@ -355,17 +355,17 @@ std::unique_ptr<FlagStateInterface> FlagImpl::SaveState() {
case FlagValueStorageKind::kOneWordAtomic: {
return absl::make_unique<FlagState>(
*this, OneWordValue().load(std::memory_order_acquire), modified,
- on_command_line, ModificationCount());
+ on_command_line, ModificationCount());
}
- case FlagValueStorageKind::kSequenceLocked: {
- void* cloned = flags_internal::Alloc(op_);
- // Read is guaranteed to be successful because we hold the lock.
- bool success =
- seq_lock_.TryRead(cloned, AtomicBufferValue(), Sizeof(op_));
- assert(success);
- static_cast<void>(success);
- return absl::make_unique<FlagState>(*this, cloned, 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.
+ bool success =
+ seq_lock_.TryRead(cloned, AtomicBufferValue(), Sizeof(op_));
+ assert(success);
+ static_cast<void>(success);
+ return absl::make_unique<FlagState>(*this, cloned, modified,
+ on_command_line, ModificationCount());
}
case FlagValueStorageKind::kAlignedBuffer: {
return absl::make_unique<FlagState>(
@@ -378,7 +378,7 @@ std::unique_ptr<FlagStateInterface> FlagImpl::SaveState() {
bool FlagImpl::RestoreState(const FlagState& flag_state) {
absl::MutexLock l(DataGuard());
- if (flag_state.counter_ == ModificationCount()) {
+ if (flag_state.counter_ == ModificationCount()) {
return false;
}
@@ -413,11 +413,11 @@ void* FlagImpl::AlignedBufferValue() const {
return OffsetValue<void>();
}
-std::atomic<uint64_t>* FlagImpl::AtomicBufferValue() const {
- assert(ValueStorageKind() == FlagValueStorageKind::kSequenceLocked);
- return OffsetValue<std::atomic<uint64_t>>();
-}
-
+std::atomic<uint64_t>* FlagImpl::AtomicBufferValue() const {
+ assert(ValueStorageKind() == FlagValueStorageKind::kSequenceLocked);
+ return OffsetValue<std::atomic<uint64_t>>();
+}
+
std::atomic<int64_t>& FlagImpl::OneWordValue() const {
assert(ValueStorageKind() == FlagValueStorageKind::kOneWordAtomic ||
ValueStorageKind() == FlagValueStorageKind::kValueAndInitBit);
@@ -453,8 +453,8 @@ void FlagImpl::Read(void* dst) const {
std::memcpy(dst, &one_word_val, Sizeof(op_));
break;
}
- case FlagValueStorageKind::kSequenceLocked: {
- ReadSequenceLockedData(dst);
+ case FlagValueStorageKind::kSequenceLocked: {
+ ReadSequenceLockedData(dst);
break;
}
case FlagValueStorageKind::kAlignedBuffer: {
@@ -482,20 +482,20 @@ bool FlagImpl::ReadOneBool() const {
.value;
}
-void FlagImpl::ReadSequenceLockedData(void* dst) const {
- int size = Sizeof(op_);
- // Attempt to read using the sequence lock.
- if (ABSL_PREDICT_TRUE(seq_lock_.TryRead(dst, AtomicBufferValue(), size))) {
- return;
- }
- // We failed due to contention. Acquire the lock to prevent contention
- // and try again.
- absl::ReaderMutexLock l(DataGuard());
- bool success = seq_lock_.TryRead(dst, AtomicBufferValue(), size);
- assert(success);
- static_cast<void>(success);
-}
-
+void FlagImpl::ReadSequenceLockedData(void* dst) const {
+ int size = Sizeof(op_);
+ // Attempt to read using the sequence lock.
+ if (ABSL_PREDICT_TRUE(seq_lock_.TryRead(dst, AtomicBufferValue(), size))) {
+ return;
+ }
+ // We failed due to contention. Acquire the lock to prevent contention
+ // and try again.
+ absl::ReaderMutexLock l(DataGuard());
+ bool success = seq_lock_.TryRead(dst, AtomicBufferValue(), size);
+ assert(success);
+ static_cast<void>(success);
+}
+
void FlagImpl::Write(const void* src) {
absl::MutexLock l(DataGuard());
diff --git a/contrib/restricted/abseil-cpp/absl/flags/internal/flag.h b/contrib/restricted/abseil-cpp/absl/flags/internal/flag.h
index 124a2f1c03..9e3a204d39 100644
--- a/contrib/restricted/abseil-cpp/absl/flags/internal/flag.h
+++ b/contrib/restricted/abseil-cpp/absl/flags/internal/flag.h
@@ -37,7 +37,7 @@
#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/internal/sequence_lock.h"
#include "absl/flags/marshalling.h"
#include "absl/meta/type_traits.h"
#include "absl/strings/string_view.h"
@@ -315,15 +315,15 @@ using FlagUseOneWordStorage = std::integral_constant<
bool, absl::type_traits_internal::is_trivially_copyable<T>::value &&
(sizeof(T) <= 8)>;
-template <class T>
+template <class T>
using FlagUseSequenceLockStorage = std::integral_constant<
bool, absl::type_traits_internal::is_trivially_copyable<T>::value &&
- (sizeof(T) > 8)>;
+ (sizeof(T) > 8)>;
enum class FlagValueStorageKind : uint8_t {
kValueAndInitBit = 0,
kOneWordAtomic = 1,
- kSequenceLocked = 2,
+ kSequenceLocked = 2,
kAlignedBuffer = 3,
};
@@ -334,8 +334,8 @@ static constexpr FlagValueStorageKind StorageKind() {
: FlagUseOneWordStorage<T>::value
? FlagValueStorageKind::kOneWordAtomic
: FlagUseSequenceLockStorage<T>::value
- ? FlagValueStorageKind::kSequenceLocked
- : FlagValueStorageKind::kAlignedBuffer;
+ ? FlagValueStorageKind::kSequenceLocked
+ : FlagValueStorageKind::kAlignedBuffer;
}
struct FlagOneWordValue {
@@ -371,7 +371,7 @@ struct FlagValue<T, FlagValueStorageKind::kValueAndInitBit> : FlagOneWordValue {
template <typename T>
struct FlagValue<T, FlagValueStorageKind::kOneWordAtomic> : FlagOneWordValue {
constexpr FlagValue() : FlagOneWordValue(UninitializedFlagValue()) {}
- bool Get(const SequenceLock&, T& dst) const {
+ 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;
@@ -382,16 +382,16 @@ struct FlagValue<T, FlagValueStorageKind::kOneWordAtomic> : FlagOneWordValue {
};
template <typename T>
-struct FlagValue<T, FlagValueStorageKind::kSequenceLocked> {
- bool Get(const SequenceLock& lock, T& dst) const {
- return lock.TryRead(&dst, value_words, sizeof(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];
+
+ 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>
@@ -507,14 +507,14 @@ class FlagImpl final : public CommandLineFlag {
// 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.
+ // 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;
-
- // The same as above, but used for sequencelock-protected storage.
- std::atomic<uint64_t>* AtomicBufferValue() 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;
@@ -527,12 +527,12 @@ class FlagImpl final : public CommandLineFlag {
// 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());
-
+ // 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_);
}
@@ -558,8 +558,8 @@ class FlagImpl final : public CommandLineFlag {
void CheckDefaultValueParsingRoundtrip() const override
ABSL_LOCKS_EXCLUDED(*DataGuard());
- int64_t ModificationCount() const ABSL_EXCLUSIVE_LOCKS_REQUIRED(*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.
@@ -606,9 +606,9 @@ class FlagImpl final : public CommandLineFlag {
// 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_;
-
+ // 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
@@ -669,9 +669,9 @@ class Flag {
impl_.AssertValidType(base_internal::FastTypeId<T>(), &GenRuntimeTypeId<T>);
#endif
- if (ABSL_PREDICT_FALSE(!value_.Get(impl_.seq_lock_, u.value))) {
- impl_.Read(&u.value);
- }
+ 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) {
@@ -772,9 +772,9 @@ struct FlagRegistrarEmpty {};
template <typename T, bool do_register>
class FlagRegistrar {
public:
- explicit FlagRegistrar(Flag<T>& flag, const char* filename) : flag_(flag) {
- if (do_register)
- flags_internal::RegisterCommandLineFlag(flag_.impl_, filename);
+ explicit FlagRegistrar(Flag<T>& flag, const char* filename) : flag_(flag) {
+ if (do_register)
+ flags_internal::RegisterCommandLineFlag(flag_.impl_, filename);
}
FlagRegistrar OnUpdate(FlagCallbackFunc cb) && {
diff --git a/contrib/restricted/abseil-cpp/absl/flags/internal/flag/ya.make b/contrib/restricted/abseil-cpp/absl/flags/internal/flag/ya.make
index 76f47ce655..12b51ff58c 100644
--- a/contrib/restricted/abseil-cpp/absl/flags/internal/flag/ya.make
+++ b/contrib/restricted/abseil-cpp/absl/flags/internal/flag/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/debugging
contrib/restricted/abseil-cpp/absl/debugging/stacktrace
contrib/restricted/abseil-cpp/absl/debugging/symbolize
@@ -24,8 +24,8 @@ PEERDIR(
contrib/restricted/abseil-cpp/absl/flags/internal/program_name
contrib/restricted/abseil-cpp/absl/flags/marshalling
contrib/restricted/abseil-cpp/absl/flags/usage_config
- contrib/restricted/abseil-cpp/absl/numeric
- contrib/restricted/abseil-cpp/absl/strings
+ contrib/restricted/abseil-cpp/absl/numeric
+ contrib/restricted/abseil-cpp/absl/strings
contrib/restricted/abseil-cpp/absl/strings/internal/absl_strings_internal
contrib/restricted/abseil-cpp/absl/strings/internal/str_format
contrib/restricted/abseil-cpp/absl/synchronization
@@ -33,25 +33,25 @@ PEERDIR(
contrib/restricted/abseil-cpp/absl/time
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
-)
-
-ADDINCL(
- GLOBAL contrib/restricted/abseil-cpp
-)
-
-NO_COMPILER_WARNINGS()
-
-NO_UTIL()
-
-CFLAGS(
- -DNOMINMAX
-)
-
+ contrib/restricted/abseil-cpp/absl/types/bad_optional_access
+)
+
+ADDINCL(
+ GLOBAL contrib/restricted/abseil-cpp
+)
+
+NO_COMPILER_WARNINGS()
+
+NO_UTIL()
+
+CFLAGS(
+ -DNOMINMAX
+)
+
SRCDIR(contrib/restricted/abseil-cpp/absl/flags/internal)
-
-SRCS(
+
+SRCS(
flag.cc
-)
-
-END()
+)
+
+END()
diff --git a/contrib/restricted/abseil-cpp/absl/flags/internal/registry.h b/contrib/restricted/abseil-cpp/absl/flags/internal/registry.h
index 4b68c85f5c..4848bda8a8 100644
--- a/contrib/restricted/abseil-cpp/absl/flags/internal/registry.h
+++ b/contrib/restricted/abseil-cpp/absl/flags/internal/registry.h
@@ -36,7 +36,7 @@ void ForEachFlag(std::function<void(CommandLineFlag&)> visitor);
//-----------------------------------------------------------------------------
-bool RegisterCommandLineFlag(CommandLineFlag&, const char* filename);
+bool RegisterCommandLineFlag(CommandLineFlag&, const char* filename);
void FinalizeRegistry();
diff --git a/contrib/restricted/abseil-cpp/absl/flags/internal/sequence_lock.h b/contrib/restricted/abseil-cpp/absl/flags/internal/sequence_lock.h
index 36318ab9d3..caa745b42a 100644
--- a/contrib/restricted/abseil-cpp/absl/flags/internal/sequence_lock.h
+++ b/contrib/restricted/abseil-cpp/absl/flags/internal/sequence_lock.h
@@ -1,187 +1,187 @@
-//
-// 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_SEQUENCE_LOCK_H_
-#define ABSL_FLAGS_INTERNAL_SEQUENCE_LOCK_H_
-
-#include <stddef.h>
-#include <stdint.h>
-
-#include <atomic>
-#include <cassert>
-#include <cstring>
-
-#include "absl/base/optimization.h"
-
-namespace absl {
-ABSL_NAMESPACE_BEGIN
-namespace flags_internal {
-
-// Align 'x' up to the nearest 'align' bytes.
-inline constexpr size_t AlignUp(size_t x, size_t align) {
- return align * ((x + align - 1) / align);
-}
-
-// A SequenceLock implements lock-free reads. A sequence counter is incremented
-// before and after each write, and readers access the counter before and after
-// accessing the protected data. If the counter is verified to not change during
-// the access, and the sequence counter value was even, then the reader knows
-// that the read was race-free and valid. Otherwise, the reader must fall back
-// to a Mutex-based code path.
-//
-// This particular SequenceLock starts in an "uninitialized" state in which
-// TryRead() returns false. It must be enabled by calling MarkInitialized().
-// This serves as a marker that the associated flag value has not yet been
-// initialized and a slow path needs to be taken.
-//
-// The memory reads and writes protected by this lock must use the provided
-// `TryRead()` and `Write()` functions. These functions behave similarly to
-// `memcpy()`, with one oddity: the protected data must be an array of
+//
+// 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_SEQUENCE_LOCK_H_
+#define ABSL_FLAGS_INTERNAL_SEQUENCE_LOCK_H_
+
+#include <stddef.h>
+#include <stdint.h>
+
+#include <atomic>
+#include <cassert>
+#include <cstring>
+
+#include "absl/base/optimization.h"
+
+namespace absl {
+ABSL_NAMESPACE_BEGIN
+namespace flags_internal {
+
+// Align 'x' up to the nearest 'align' bytes.
+inline constexpr size_t AlignUp(size_t x, size_t align) {
+ return align * ((x + align - 1) / align);
+}
+
+// A SequenceLock implements lock-free reads. A sequence counter is incremented
+// before and after each write, and readers access the counter before and after
+// accessing the protected data. If the counter is verified to not change during
+// the access, and the sequence counter value was even, then the reader knows
+// that the read was race-free and valid. Otherwise, the reader must fall back
+// to a Mutex-based code path.
+//
+// This particular SequenceLock starts in an "uninitialized" state in which
+// TryRead() returns false. It must be enabled by calling MarkInitialized().
+// This serves as a marker that the associated flag value has not yet been
+// initialized and a slow path needs to be taken.
+//
+// The memory reads and writes protected by this lock must use the provided
+// `TryRead()` and `Write()` functions. These functions behave similarly to
+// `memcpy()`, with one oddity: the protected data must be an array of
// `std::atomic<uint64>`. This is to comply with the C++ standard, which
-// considers data races on non-atomic objects to be undefined behavior. See "Can
-// Seqlocks Get Along With Programming Language Memory Models?"[1] by Hans J.
-// Boehm for more details.
-//
-// [1] https://www.hpl.hp.com/techreports/2012/HPL-2012-68.pdf
-class SequenceLock {
- public:
- constexpr SequenceLock() : lock_(kUninitialized) {}
-
- // Mark that this lock is ready for use.
- void MarkInitialized() {
- assert(lock_.load(std::memory_order_relaxed) == kUninitialized);
- lock_.store(0, std::memory_order_release);
- }
-
- // Copy "size" bytes of data from "src" to "dst", protected as a read-side
- // critical section of the sequence lock.
- //
- // Unlike traditional sequence lock implementations which loop until getting a
- // clean read, this implementation returns false in the case of concurrent
- // calls to `Write`. In such a case, the caller should fall back to a
- // locking-based slow path.
- //
- // Returns false if the sequence lock was not yet marked as initialized.
- //
- // NOTE: If this returns false, "dst" may be overwritten with undefined
- // (potentially uninitialized) data.
- bool TryRead(void* dst, const std::atomic<uint64_t>* src, size_t size) const {
- // Acquire barrier ensures that no loads done by f() are reordered
- // above the first load of the sequence counter.
- int64_t seq_before = lock_.load(std::memory_order_acquire);
- if (ABSL_PREDICT_FALSE(seq_before & 1) == 1) return false;
- RelaxedCopyFromAtomic(dst, src, size);
- // Another acquire fence ensures that the load of 'lock_' below is
- // strictly ordered after the RelaxedCopyToAtomic call above.
- std::atomic_thread_fence(std::memory_order_acquire);
- int64_t seq_after = lock_.load(std::memory_order_relaxed);
- return ABSL_PREDICT_TRUE(seq_before == seq_after);
- }
-
- // Copy "size" bytes from "src" to "dst" as a write-side critical section
- // of the sequence lock. Any concurrent readers will be forced to retry
- // until they get a read that does not conflict with this write.
- //
- // This call must be externally synchronized against other calls to Write,
- // but may proceed concurrently with reads.
- void Write(std::atomic<uint64_t>* dst, const void* src, size_t size) {
- // We can use relaxed instructions to increment the counter since we
- // are extenally synchronized. The std::atomic_thread_fence below
- // ensures that the counter updates don't get interleaved with the
- // copy to the data.
- int64_t orig_seq = lock_.load(std::memory_order_relaxed);
- assert((orig_seq & 1) == 0); // Must be initially unlocked.
- lock_.store(orig_seq + 1, std::memory_order_relaxed);
-
- // We put a release fence between update to lock_ and writes to shared data.
- // Thus all stores to shared data are effectively release operations and
- // update to lock_ above cannot be re-ordered past any of them. Note that
- // this barrier is not for the fetch_add above. A release barrier for the
- // fetch_add would be before it, not after.
- std::atomic_thread_fence(std::memory_order_release);
- RelaxedCopyToAtomic(dst, src, size);
- // "Release" semantics ensure that none of the writes done by
- // RelaxedCopyToAtomic() can be reordered after the following modification.
- lock_.store(orig_seq + 2, std::memory_order_release);
- }
-
- // Return the number of times that Write() has been called.
- //
- // REQUIRES: This must be externally synchronized against concurrent calls to
- // `Write()` or `IncrementModificationCount()`.
- // REQUIRES: `MarkInitialized()` must have been previously called.
- int64_t ModificationCount() const {
- int64_t val = lock_.load(std::memory_order_relaxed);
- assert(val != kUninitialized && (val & 1) == 0);
- return val / 2;
- }
-
- // REQUIRES: This must be externally synchronized against concurrent calls to
- // `Write()` or `ModificationCount()`.
- // REQUIRES: `MarkInitialized()` must have been previously called.
- void IncrementModificationCount() {
- int64_t val = lock_.load(std::memory_order_relaxed);
- assert(val != kUninitialized);
- lock_.store(val + 2, std::memory_order_relaxed);
- }
-
- private:
- // Perform the equivalent of "memcpy(dst, src, size)", but using relaxed
- // atomics.
- static void RelaxedCopyFromAtomic(void* dst, const std::atomic<uint64_t>* src,
- size_t size) {
- char* dst_byte = static_cast<char*>(dst);
- while (size >= sizeof(uint64_t)) {
- uint64_t word = src->load(std::memory_order_relaxed);
- std::memcpy(dst_byte, &word, sizeof(word));
- dst_byte += sizeof(word);
- src++;
- size -= sizeof(word);
- }
- if (size > 0) {
- uint64_t word = src->load(std::memory_order_relaxed);
- std::memcpy(dst_byte, &word, size);
- }
- }
-
- // Perform the equivalent of "memcpy(dst, src, size)", but using relaxed
- // atomics.
- static void RelaxedCopyToAtomic(std::atomic<uint64_t>* dst, const void* src,
- size_t size) {
- const char* src_byte = static_cast<const char*>(src);
- while (size >= sizeof(uint64_t)) {
- uint64_t word;
- std::memcpy(&word, src_byte, sizeof(word));
- dst->store(word, std::memory_order_relaxed);
- src_byte += sizeof(word);
- dst++;
- size -= sizeof(word);
- }
- if (size > 0) {
- uint64_t word = 0;
- std::memcpy(&word, src_byte, size);
- dst->store(word, std::memory_order_relaxed);
- }
- }
-
- static constexpr int64_t kUninitialized = -1;
- std::atomic<int64_t> lock_;
-};
-
-} // namespace flags_internal
-ABSL_NAMESPACE_END
-} // namespace absl
-
-#endif // ABSL_FLAGS_INTERNAL_SEQUENCE_LOCK_H_
+// considers data races on non-atomic objects to be undefined behavior. See "Can
+// Seqlocks Get Along With Programming Language Memory Models?"[1] by Hans J.
+// Boehm for more details.
+//
+// [1] https://www.hpl.hp.com/techreports/2012/HPL-2012-68.pdf
+class SequenceLock {
+ public:
+ constexpr SequenceLock() : lock_(kUninitialized) {}
+
+ // Mark that this lock is ready for use.
+ void MarkInitialized() {
+ assert(lock_.load(std::memory_order_relaxed) == kUninitialized);
+ lock_.store(0, std::memory_order_release);
+ }
+
+ // Copy "size" bytes of data from "src" to "dst", protected as a read-side
+ // critical section of the sequence lock.
+ //
+ // Unlike traditional sequence lock implementations which loop until getting a
+ // clean read, this implementation returns false in the case of concurrent
+ // calls to `Write`. In such a case, the caller should fall back to a
+ // locking-based slow path.
+ //
+ // Returns false if the sequence lock was not yet marked as initialized.
+ //
+ // NOTE: If this returns false, "dst" may be overwritten with undefined
+ // (potentially uninitialized) data.
+ bool TryRead(void* dst, const std::atomic<uint64_t>* src, size_t size) const {
+ // Acquire barrier ensures that no loads done by f() are reordered
+ // above the first load of the sequence counter.
+ int64_t seq_before = lock_.load(std::memory_order_acquire);
+ if (ABSL_PREDICT_FALSE(seq_before & 1) == 1) return false;
+ RelaxedCopyFromAtomic(dst, src, size);
+ // Another acquire fence ensures that the load of 'lock_' below is
+ // strictly ordered after the RelaxedCopyToAtomic call above.
+ std::atomic_thread_fence(std::memory_order_acquire);
+ int64_t seq_after = lock_.load(std::memory_order_relaxed);
+ return ABSL_PREDICT_TRUE(seq_before == seq_after);
+ }
+
+ // Copy "size" bytes from "src" to "dst" as a write-side critical section
+ // of the sequence lock. Any concurrent readers will be forced to retry
+ // until they get a read that does not conflict with this write.
+ //
+ // This call must be externally synchronized against other calls to Write,
+ // but may proceed concurrently with reads.
+ void Write(std::atomic<uint64_t>* dst, const void* src, size_t size) {
+ // We can use relaxed instructions to increment the counter since we
+ // are extenally synchronized. The std::atomic_thread_fence below
+ // ensures that the counter updates don't get interleaved with the
+ // copy to the data.
+ int64_t orig_seq = lock_.load(std::memory_order_relaxed);
+ assert((orig_seq & 1) == 0); // Must be initially unlocked.
+ lock_.store(orig_seq + 1, std::memory_order_relaxed);
+
+ // We put a release fence between update to lock_ and writes to shared data.
+ // Thus all stores to shared data are effectively release operations and
+ // update to lock_ above cannot be re-ordered past any of them. Note that
+ // this barrier is not for the fetch_add above. A release barrier for the
+ // fetch_add would be before it, not after.
+ std::atomic_thread_fence(std::memory_order_release);
+ RelaxedCopyToAtomic(dst, src, size);
+ // "Release" semantics ensure that none of the writes done by
+ // RelaxedCopyToAtomic() can be reordered after the following modification.
+ lock_.store(orig_seq + 2, std::memory_order_release);
+ }
+
+ // Return the number of times that Write() has been called.
+ //
+ // REQUIRES: This must be externally synchronized against concurrent calls to
+ // `Write()` or `IncrementModificationCount()`.
+ // REQUIRES: `MarkInitialized()` must have been previously called.
+ int64_t ModificationCount() const {
+ int64_t val = lock_.load(std::memory_order_relaxed);
+ assert(val != kUninitialized && (val & 1) == 0);
+ return val / 2;
+ }
+
+ // REQUIRES: This must be externally synchronized against concurrent calls to
+ // `Write()` or `ModificationCount()`.
+ // REQUIRES: `MarkInitialized()` must have been previously called.
+ void IncrementModificationCount() {
+ int64_t val = lock_.load(std::memory_order_relaxed);
+ assert(val != kUninitialized);
+ lock_.store(val + 2, std::memory_order_relaxed);
+ }
+
+ private:
+ // Perform the equivalent of "memcpy(dst, src, size)", but using relaxed
+ // atomics.
+ static void RelaxedCopyFromAtomic(void* dst, const std::atomic<uint64_t>* src,
+ size_t size) {
+ char* dst_byte = static_cast<char*>(dst);
+ while (size >= sizeof(uint64_t)) {
+ uint64_t word = src->load(std::memory_order_relaxed);
+ std::memcpy(dst_byte, &word, sizeof(word));
+ dst_byte += sizeof(word);
+ src++;
+ size -= sizeof(word);
+ }
+ if (size > 0) {
+ uint64_t word = src->load(std::memory_order_relaxed);
+ std::memcpy(dst_byte, &word, size);
+ }
+ }
+
+ // Perform the equivalent of "memcpy(dst, src, size)", but using relaxed
+ // atomics.
+ static void RelaxedCopyToAtomic(std::atomic<uint64_t>* dst, const void* src,
+ size_t size) {
+ const char* src_byte = static_cast<const char*>(src);
+ while (size >= sizeof(uint64_t)) {
+ uint64_t word;
+ std::memcpy(&word, src_byte, sizeof(word));
+ dst->store(word, std::memory_order_relaxed);
+ src_byte += sizeof(word);
+ dst++;
+ size -= sizeof(word);
+ }
+ if (size > 0) {
+ uint64_t word = 0;
+ std::memcpy(&word, src_byte, size);
+ dst->store(word, std::memory_order_relaxed);
+ }
+ }
+
+ static constexpr int64_t kUninitialized = -1;
+ std::atomic<int64_t> lock_;
+};
+
+} // namespace flags_internal
+ABSL_NAMESPACE_END
+} // namespace absl
+
+#endif // ABSL_FLAGS_INTERNAL_SEQUENCE_LOCK_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..a3a7d5c933 100644
--- a/contrib/restricted/abseil-cpp/absl/flags/internal/usage.cc
+++ b/contrib/restricted/abseil-cpp/absl/flags/internal/usage.cc
@@ -37,26 +37,26 @@
#include "absl/strings/str_split.h"
#include "absl/strings/string_view.h"
-// Dummy global variables to prevent anyone else defining these.
-bool FLAGS_help = false;
-bool FLAGS_helpfull = false;
-bool FLAGS_helpshort = false;
-bool FLAGS_helppackage = false;
-bool FLAGS_version = false;
-bool FLAGS_only_check_args = false;
-bool FLAGS_helpon = false;
-bool FLAGS_helpmatch = false;
+// Dummy global variables to prevent anyone else defining these.
+bool FLAGS_help = false;
+bool FLAGS_helpfull = false;
+bool FLAGS_helpshort = false;
+bool FLAGS_helppackage = false;
+bool FLAGS_version = false;
+bool FLAGS_only_check_args = false;
+bool FLAGS_helpon = false;
+bool FLAGS_helpmatch = false;
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace flags_internal {
namespace {
-using PerFlagFilter = std::function<bool(const absl::CommandLineFlag&)>;
-
-// Maximum length size in a human readable format.
-constexpr size_t kHrfMaxLineLength = 80;
-
+using PerFlagFilter = std::function<bool(const absl::CommandLineFlag&)>;
+
+// Maximum length size in a human readable format.
+constexpr size_t kHrfMaxLineLength = 80;
+
// This class is used to emit an XML element with `tag` and `text`.
// It adds opening and closing tags and escapes special characters in the text.
// For example:
@@ -109,12 +109,12 @@ class FlagHelpPrettyPrinter {
public:
// Pretty printer holds on to the std::ostream& reference to direct an output
// to that stream.
- FlagHelpPrettyPrinter(size_t max_line_len, size_t min_line_len,
- size_t wrapped_line_indent, std::ostream& out)
+ FlagHelpPrettyPrinter(size_t max_line_len, size_t min_line_len,
+ size_t wrapped_line_indent, std::ostream& out)
: out_(out),
max_line_len_(max_line_len),
- min_line_len_(min_line_len),
- wrapped_line_indent_(wrapped_line_indent),
+ min_line_len_(min_line_len),
+ wrapped_line_indent_(wrapped_line_indent),
line_len_(0),
first_line_(true) {}
@@ -168,12 +168,12 @@ class FlagHelpPrettyPrinter {
void StartLine() {
if (first_line_) {
- line_len_ = min_line_len_;
+ line_len_ = min_line_len_;
first_line_ = false;
} else {
- line_len_ = min_line_len_ + wrapped_line_indent_;
+ line_len_ = min_line_len_ + wrapped_line_indent_;
}
- out_ << std::string(line_len_, ' ');
+ out_ << std::string(line_len_, ' ');
}
void EndLine() {
out_ << '\n';
@@ -182,15 +182,15 @@ class FlagHelpPrettyPrinter {
private:
std::ostream& out_;
- const size_t max_line_len_;
- const size_t min_line_len_;
- const size_t wrapped_line_indent_;
- size_t line_len_;
+ const size_t max_line_len_;
+ const size_t min_line_len_;
+ const size_t wrapped_line_indent_;
+ size_t line_len_;
bool first_line_;
};
void FlagHelpHumanReadable(const CommandLineFlag& flag, std::ostream& out) {
- FlagHelpPrettyPrinter printer(kHrfMaxLineLength, 4, 2, out);
+ FlagHelpPrettyPrinter printer(kHrfMaxLineLength, 4, 2, out);
// Flag name.
printer.Write(absl::StrCat("--", flag.Name()));
@@ -226,7 +226,7 @@ void FlagHelpHumanReadable(const CommandLineFlag& flag, std::ostream& out) {
// If a flag's help message has been stripped (e.g. by adding '#define
// STRIP_FLAG_HELP 1' then this flag will not be displayed by '--help'
// and its variants.
-void FlagsHelpImpl(std::ostream& out, PerFlagFilter filter_cb,
+void FlagsHelpImpl(std::ostream& out, PerFlagFilter filter_cb,
HelpFormat format, absl::string_view program_usage_message) {
if (format == HelpFormat::kHumanReadable) {
out << flags_internal::ShortProgramInvocationName() << ": "
@@ -261,9 +261,9 @@ void FlagsHelpImpl(std::ostream& out, PerFlagFilter filter_cb,
// If the flag has been stripped, pretend that it doesn't exist.
if (flag.Help() == flags_internal::kStrippedFlagHelp) return;
- // Make sure flag satisfies the filter
- if (!filter_cb(flag)) return;
-
+ // Make sure flag satisfies the filter
+ if (!filter_cb(flag)) return;
+
std::string flag_filename = flag.Filename();
matching_flags[std::string(flags_internal::Package(flag_filename))]
@@ -300,34 +300,34 @@ void FlagsHelpImpl(std::ostream& out, PerFlagFilter filter_cb,
}
if (format == HelpFormat::kHumanReadable) {
- FlagHelpPrettyPrinter printer(kHrfMaxLineLength, 0, 0, out);
-
+ FlagHelpPrettyPrinter printer(kHrfMaxLineLength, 0, 0, out);
+
if (filter_cb && matching_flags.empty()) {
- printer.Write("No flags matched.\n", true);
+ printer.Write("No flags matched.\n", true);
}
- printer.EndLine();
- printer.Write(
- "Try --helpfull to get a list of all flags or --help=substring "
- "shows help for flags which include specified substring in either "
- "in the name, or description or path.\n",
- true);
+ printer.EndLine();
+ printer.Write(
+ "Try --helpfull to get a list of all flags or --help=substring "
+ "shows help for flags which include specified substring in either "
+ "in the name, or description or path.\n",
+ true);
} else {
// The end of the document.
out << "</AllFlags>\n";
}
}
-void FlagsHelpImpl(std::ostream& out,
- flags_internal::FlagKindFilter filename_filter_cb,
- HelpFormat format, absl::string_view program_usage_message) {
- FlagsHelpImpl(
- out,
- [&](const absl::CommandLineFlag& flag) {
- return filename_filter_cb && filename_filter_cb(flag.Filename());
- },
- format, program_usage_message);
-}
-
+void FlagsHelpImpl(std::ostream& out,
+ flags_internal::FlagKindFilter filename_filter_cb,
+ HelpFormat format, absl::string_view program_usage_message) {
+ FlagsHelpImpl(
+ out,
+ [&](const absl::CommandLineFlag& flag) {
+ return filename_filter_cb && filename_filter_cb(flag.Filename());
+ },
+ format, program_usage_message);
+}
+
} // namespace
// --------------------------------------------------------------------
@@ -339,7 +339,7 @@ void FlagHelp(std::ostream& out, const CommandLineFlag& flag,
}
// --------------------------------------------------------------------
-// Produces the help messages for all flags matching the filename filter.
+// Produces the help messages for all flags matching the filename filter.
// If filter is empty produces help messages for all flags.
void FlagsHelp(std::ostream& out, absl::string_view filter, HelpFormat format,
absl::string_view program_usage_message) {
@@ -354,169 +354,169 @@ void FlagsHelp(std::ostream& out, absl::string_view filter, HelpFormat format,
// If so, handles them appropriately.
int HandleUsageFlags(std::ostream& out,
absl::string_view program_usage_message) {
- switch (GetFlagsHelpMode()) {
- case HelpMode::kNone:
- break;
- case HelpMode::kImportant:
- flags_internal::FlagsHelpImpl(
- out, flags_internal::GetUsageConfig().contains_help_flags,
- GetFlagsHelpFormat(), program_usage_message);
- return 1;
-
- case HelpMode::kShort:
- flags_internal::FlagsHelpImpl(
- out, flags_internal::GetUsageConfig().contains_helpshort_flags,
- GetFlagsHelpFormat(), program_usage_message);
- return 1;
-
- case HelpMode::kFull:
- flags_internal::FlagsHelp(out, "", GetFlagsHelpFormat(),
- program_usage_message);
- return 1;
-
- case HelpMode::kPackage:
- flags_internal::FlagsHelpImpl(
- out, flags_internal::GetUsageConfig().contains_helppackage_flags,
- GetFlagsHelpFormat(), program_usage_message);
-
- return 1;
-
- case HelpMode::kMatch: {
- std::string substr = GetFlagsHelpMatchSubstr();
- if (substr.empty()) {
- // show all options
- flags_internal::FlagsHelp(out, substr, GetFlagsHelpFormat(),
- program_usage_message);
- } else {
- auto filter_cb = [&substr](const absl::CommandLineFlag& flag) {
- if (absl::StrContains(flag.Name(), substr)) return true;
- if (absl::StrContains(flag.Filename(), substr)) return true;
- if (absl::StrContains(flag.Help(), substr)) return true;
-
- return false;
- };
- flags_internal::FlagsHelpImpl(
- out, filter_cb, HelpFormat::kHumanReadable, program_usage_message);
- }
-
- return 1;
- }
- case HelpMode::kVersion:
- if (flags_internal::GetUsageConfig().version_string)
- out << flags_internal::GetUsageConfig().version_string();
- // Unlike help, we may be asking for version in a script, so return 0
- return 0;
-
- case HelpMode::kOnlyCheckArgs:
- return 0;
+ switch (GetFlagsHelpMode()) {
+ case HelpMode::kNone:
+ break;
+ case HelpMode::kImportant:
+ flags_internal::FlagsHelpImpl(
+ out, flags_internal::GetUsageConfig().contains_help_flags,
+ GetFlagsHelpFormat(), program_usage_message);
+ return 1;
+
+ case HelpMode::kShort:
+ flags_internal::FlagsHelpImpl(
+ out, flags_internal::GetUsageConfig().contains_helpshort_flags,
+ GetFlagsHelpFormat(), program_usage_message);
+ return 1;
+
+ case HelpMode::kFull:
+ flags_internal::FlagsHelp(out, "", GetFlagsHelpFormat(),
+ program_usage_message);
+ return 1;
+
+ case HelpMode::kPackage:
+ flags_internal::FlagsHelpImpl(
+ out, flags_internal::GetUsageConfig().contains_helppackage_flags,
+ GetFlagsHelpFormat(), program_usage_message);
+
+ return 1;
+
+ case HelpMode::kMatch: {
+ std::string substr = GetFlagsHelpMatchSubstr();
+ if (substr.empty()) {
+ // show all options
+ flags_internal::FlagsHelp(out, substr, GetFlagsHelpFormat(),
+ program_usage_message);
+ } else {
+ auto filter_cb = [&substr](const absl::CommandLineFlag& flag) {
+ if (absl::StrContains(flag.Name(), substr)) return true;
+ if (absl::StrContains(flag.Filename(), substr)) return true;
+ if (absl::StrContains(flag.Help(), substr)) return true;
+
+ return false;
+ };
+ flags_internal::FlagsHelpImpl(
+ out, filter_cb, HelpFormat::kHumanReadable, program_usage_message);
+ }
+
+ return 1;
+ }
+ case HelpMode::kVersion:
+ if (flags_internal::GetUsageConfig().version_string)
+ out << flags_internal::GetUsageConfig().version_string();
+ // Unlike help, we may be asking for version in a script, so return 0
+ return 0;
+
+ case HelpMode::kOnlyCheckArgs:
+ return 0;
}
- return -1;
-}
-
-// --------------------------------------------------------------------
-// Globals representing usage reporting flags
-
-namespace {
-
-ABSL_CONST_INIT absl::Mutex help_attributes_guard(absl::kConstInit);
-ABSL_CONST_INIT std::string* match_substr
- ABSL_GUARDED_BY(help_attributes_guard) = nullptr;
-ABSL_CONST_INIT HelpMode help_mode ABSL_GUARDED_BY(help_attributes_guard) =
- HelpMode::kNone;
-ABSL_CONST_INIT HelpFormat help_format ABSL_GUARDED_BY(help_attributes_guard) =
- HelpFormat::kHumanReadable;
-
-} // namespace
-
-std::string GetFlagsHelpMatchSubstr() {
- absl::MutexLock l(&help_attributes_guard);
- if (match_substr == nullptr) return "";
- return *match_substr;
-}
-
-void SetFlagsHelpMatchSubstr(absl::string_view substr) {
- absl::MutexLock l(&help_attributes_guard);
- if (match_substr == nullptr) match_substr = new std::string;
- match_substr->assign(substr.data(), substr.size());
-}
-
-HelpMode GetFlagsHelpMode() {
- absl::MutexLock l(&help_attributes_guard);
- return help_mode;
-}
-
-void SetFlagsHelpMode(HelpMode mode) {
- absl::MutexLock l(&help_attributes_guard);
- help_mode = mode;
-}
-
-HelpFormat GetFlagsHelpFormat() {
- absl::MutexLock l(&help_attributes_guard);
- return help_format;
-}
-
-void SetFlagsHelpFormat(HelpFormat format) {
- absl::MutexLock l(&help_attributes_guard);
- help_format = format;
-}
-
-// Deduces usage flags from the input argument in a form --name=value or
-// --name. argument is already split into name and value before we call this
-// function.
-bool DeduceUsageFlags(absl::string_view name, absl::string_view value) {
- if (absl::ConsumePrefix(&name, "help")) {
- if (name == "") {
- if (value.empty()) {
- SetFlagsHelpMode(HelpMode::kImportant);
- } else {
- SetFlagsHelpMode(HelpMode::kMatch);
- SetFlagsHelpMatchSubstr(value);
- }
- return true;
- }
-
- if (name == "match") {
- SetFlagsHelpMode(HelpMode::kMatch);
- SetFlagsHelpMatchSubstr(value);
- return true;
- }
-
- if (name == "on") {
- SetFlagsHelpMode(HelpMode::kMatch);
- SetFlagsHelpMatchSubstr(absl::StrCat("/", value, "."));
- return true;
- }
-
- if (name == "full") {
- SetFlagsHelpMode(HelpMode::kFull);
- return true;
- }
-
- if (name == "short") {
- SetFlagsHelpMode(HelpMode::kShort);
- return true;
- }
-
- if (name == "package") {
- SetFlagsHelpMode(HelpMode::kPackage);
- return true;
- }
-
- return false;
+ return -1;
+}
+
+// --------------------------------------------------------------------
+// Globals representing usage reporting flags
+
+namespace {
+
+ABSL_CONST_INIT absl::Mutex help_attributes_guard(absl::kConstInit);
+ABSL_CONST_INIT std::string* match_substr
+ ABSL_GUARDED_BY(help_attributes_guard) = nullptr;
+ABSL_CONST_INIT HelpMode help_mode ABSL_GUARDED_BY(help_attributes_guard) =
+ HelpMode::kNone;
+ABSL_CONST_INIT HelpFormat help_format ABSL_GUARDED_BY(help_attributes_guard) =
+ HelpFormat::kHumanReadable;
+
+} // namespace
+
+std::string GetFlagsHelpMatchSubstr() {
+ absl::MutexLock l(&help_attributes_guard);
+ if (match_substr == nullptr) return "";
+ return *match_substr;
+}
+
+void SetFlagsHelpMatchSubstr(absl::string_view substr) {
+ absl::MutexLock l(&help_attributes_guard);
+ if (match_substr == nullptr) match_substr = new std::string;
+ match_substr->assign(substr.data(), substr.size());
+}
+
+HelpMode GetFlagsHelpMode() {
+ absl::MutexLock l(&help_attributes_guard);
+ return help_mode;
+}
+
+void SetFlagsHelpMode(HelpMode mode) {
+ absl::MutexLock l(&help_attributes_guard);
+ help_mode = mode;
+}
+
+HelpFormat GetFlagsHelpFormat() {
+ absl::MutexLock l(&help_attributes_guard);
+ return help_format;
+}
+
+void SetFlagsHelpFormat(HelpFormat format) {
+ absl::MutexLock l(&help_attributes_guard);
+ help_format = format;
+}
+
+// Deduces usage flags from the input argument in a form --name=value or
+// --name. argument is already split into name and value before we call this
+// function.
+bool DeduceUsageFlags(absl::string_view name, absl::string_view value) {
+ if (absl::ConsumePrefix(&name, "help")) {
+ if (name == "") {
+ if (value.empty()) {
+ SetFlagsHelpMode(HelpMode::kImportant);
+ } else {
+ SetFlagsHelpMode(HelpMode::kMatch);
+ SetFlagsHelpMatchSubstr(value);
+ }
+ return true;
+ }
+
+ if (name == "match") {
+ SetFlagsHelpMode(HelpMode::kMatch);
+ SetFlagsHelpMatchSubstr(value);
+ return true;
+ }
+
+ if (name == "on") {
+ SetFlagsHelpMode(HelpMode::kMatch);
+ SetFlagsHelpMatchSubstr(absl::StrCat("/", value, "."));
+ return true;
+ }
+
+ if (name == "full") {
+ SetFlagsHelpMode(HelpMode::kFull);
+ return true;
+ }
+
+ if (name == "short") {
+ SetFlagsHelpMode(HelpMode::kShort);
+ return true;
+ }
+
+ if (name == "package") {
+ SetFlagsHelpMode(HelpMode::kPackage);
+ return true;
+ }
+
+ return false;
}
- if (name == "version") {
- SetFlagsHelpMode(HelpMode::kVersion);
- return true;
+ if (name == "version") {
+ SetFlagsHelpMode(HelpMode::kVersion);
+ return true;
}
- if (name == "only_check_args") {
- SetFlagsHelpMode(HelpMode::kOnlyCheckArgs);
- return true;
+ if (name == "only_check_args") {
+ SetFlagsHelpMode(HelpMode::kOnlyCheckArgs);
+ return true;
}
- return false;
+ return false;
}
} // namespace flags_internal
diff --git a/contrib/restricted/abseil-cpp/absl/flags/internal/usage.h b/contrib/restricted/abseil-cpp/absl/flags/internal/usage.h
index c0bcac5762..5198d75225 100644
--- a/contrib/restricted/abseil-cpp/absl/flags/internal/usage.h
+++ b/contrib/restricted/abseil-cpp/absl/flags/internal/usage.h
@@ -66,37 +66,37 @@ void FlagsHelp(std::ostream& out, absl::string_view filter,
int HandleUsageFlags(std::ostream& out,
absl::string_view program_usage_message);
-// --------------------------------------------------------------------
-// Globals representing usage reporting flags
-
-enum class HelpMode {
- kNone,
- kImportant,
- kShort,
- kFull,
- kPackage,
- kMatch,
- kVersion,
- kOnlyCheckArgs
-};
-
-// Returns substring to filter help output (--help=substr argument)
-std::string GetFlagsHelpMatchSubstr();
-// Returns the requested help mode.
-HelpMode GetFlagsHelpMode();
-// Returns the requested help format.
-HelpFormat GetFlagsHelpFormat();
-
-// These are corresponding setters to the attributes above.
-void SetFlagsHelpMatchSubstr(absl::string_view);
-void SetFlagsHelpMode(HelpMode);
-void SetFlagsHelpFormat(HelpFormat);
-
-// Deduces usage flags from the input argument in a form --name=value or
-// --name. argument is already split into name and value before we call this
-// function.
-bool DeduceUsageFlags(absl::string_view name, absl::string_view value);
-
+// --------------------------------------------------------------------
+// Globals representing usage reporting flags
+
+enum class HelpMode {
+ kNone,
+ kImportant,
+ kShort,
+ kFull,
+ kPackage,
+ kMatch,
+ kVersion,
+ kOnlyCheckArgs
+};
+
+// Returns substring to filter help output (--help=substr argument)
+std::string GetFlagsHelpMatchSubstr();
+// Returns the requested help mode.
+HelpMode GetFlagsHelpMode();
+// Returns the requested help format.
+HelpFormat GetFlagsHelpFormat();
+
+// These are corresponding setters to the attributes above.
+void SetFlagsHelpMatchSubstr(absl::string_view);
+void SetFlagsHelpMode(HelpMode);
+void SetFlagsHelpFormat(HelpFormat);
+
+// Deduces usage flags from the input argument in a form --name=value or
+// --name. argument is already split into name and value before we call this
+// function.
+bool DeduceUsageFlags(absl::string_view name, absl::string_view value);
+
} // namespace flags_internal
ABSL_NAMESPACE_END
} // namespace absl
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..3973999aa3 100644
--- a/contrib/restricted/abseil-cpp/absl/flags/internal/usage/ya.make
+++ b/contrib/restricted/abseil-cpp/absl/flags/internal/usage/ya.make
@@ -10,7 +10,7 @@ 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/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
@@ -18,10 +18,10 @@ PEERDIR(
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
- contrib/restricted/abseil-cpp/absl/debugging
- contrib/restricted/abseil-cpp/absl/debugging/stacktrace
- contrib/restricted/abseil-cpp/absl/debugging/symbolize
- contrib/restricted/abseil-cpp/absl/demangle
+ contrib/restricted/abseil-cpp/absl/debugging
+ contrib/restricted/abseil-cpp/absl/debugging/stacktrace
+ contrib/restricted/abseil-cpp/absl/debugging/symbolize
+ contrib/restricted/abseil-cpp/absl/demangle
contrib/restricted/abseil-cpp/absl/flags
contrib/restricted/abseil-cpp/absl/flags/commandlineflag
contrib/restricted/abseil-cpp/absl/flags/internal/commandlineflag
@@ -42,13 +42,13 @@ PEERDIR(
contrib/restricted/abseil-cpp/absl/strings/internal/cordz_functions
contrib/restricted/abseil-cpp/absl/strings/internal/cordz_handle
contrib/restricted/abseil-cpp/absl/strings/internal/cordz_info
- contrib/restricted/abseil-cpp/absl/strings/internal/str_format
+ contrib/restricted/abseil-cpp/absl/strings/internal/str_format
contrib/restricted/abseil-cpp/absl/synchronization
contrib/restricted/abseil-cpp/absl/synchronization/internal
contrib/restricted/abseil-cpp/absl/time
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_optional_access
contrib/restricted/abseil-cpp/absl/types/bad_variant_access
)
diff --git a/contrib/restricted/abseil-cpp/absl/flags/marshalling.h b/contrib/restricted/abseil-cpp/absl/flags/marshalling.h
index 7cbc136d57..00704d1ea3 100644
--- a/contrib/restricted/abseil-cpp/absl/flags/marshalling.h
+++ b/contrib/restricted/abseil-cpp/absl/flags/marshalling.h
@@ -83,7 +83,7 @@
// // AbslParseFlag converts from a string to OutputMode.
// // Must be in same namespace as OutputMode.
//
-// // Parses an OutputMode from the command line flag value `text`. Returns
+// // Parses an OutputMode from the command line flag value `text`. Returns
// // `true` and sets `*mode` on success; returns `false` and sets `*error`
// // on failure.
// bool AbslParseFlag(absl::string_view text,
@@ -139,7 +139,7 @@
//
// // Within the implementation, `AbslParseFlag()` will, in turn invoke
// // `absl::ParseFlag()` on its constituent `int` and `std::string` types
-// // (which have built-in Abseil flag support).
+// // (which have built-in Abseil flag support).
//
// bool AbslParseFlag(absl::string_view text, MyFlagType* flag,
// std::string* err) {
diff --git a/contrib/restricted/abseil-cpp/absl/flags/marshalling/ya.make b/contrib/restricted/abseil-cpp/absl/flags/marshalling/ya.make
index 1b02b87173..102f239809 100644
--- a/contrib/restricted/abseil-cpp/absl/flags/marshalling/ya.make
+++ b/contrib/restricted/abseil-cpp/absl/flags/marshalling/ya.make
@@ -1,41 +1,41 @@
-# 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
- 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/numeric
- contrib/restricted/abseil-cpp/absl/strings
+OWNER(g:cpp-contrib)
+
+LICENSE(Apache-2.0)
+
+PEERDIR(
+ contrib/restricted/abseil-cpp/absl/base
+ 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/numeric
+ contrib/restricted/abseil-cpp/absl/strings
contrib/restricted/abseil-cpp/absl/strings/internal/absl_strings_internal
contrib/restricted/abseil-cpp/absl/strings/internal/str_format
-)
-
-ADDINCL(
- GLOBAL contrib/restricted/abseil-cpp
-)
-
-NO_COMPILER_WARNINGS()
-
-NO_UTIL()
-
-CFLAGS(
- -DNOMINMAX
-)
-
+)
+
+ADDINCL(
+ GLOBAL contrib/restricted/abseil-cpp
+)
+
+NO_COMPILER_WARNINGS()
+
+NO_UTIL()
+
+CFLAGS(
+ -DNOMINMAX
+)
+
SRCDIR(contrib/restricted/abseil-cpp/absl/flags)
-
-SRCS(
+
+SRCS(
marshalling.cc
-)
-
-END()
+)
+
+END()
diff --git a/contrib/restricted/abseil-cpp/absl/flags/parse.cc b/contrib/restricted/abseil-cpp/absl/flags/parse.cc
index dd1a6796ca..5c8738309d 100644
--- a/contrib/restricted/abseil-cpp/absl/flags/parse.cc
+++ b/contrib/restricted/abseil-cpp/absl/flags/parse.cc
@@ -713,11 +713,11 @@ std::vector<char*> ParseCommandLineImpl(int argc, char* argv[],
std::tie(flag, is_negative) = LocateFlag(flag_name);
if (flag == nullptr) {
- // Usage flags are not modeled as Abseil flags. Locate them separately.
- if (flags_internal::DeduceUsageFlags(flag_name, value)) {
- continue;
- }
-
+ // Usage flags are not modeled as Abseil flags. Locate them separately.
+ if (flags_internal::DeduceUsageFlags(flag_name, value)) {
+ continue;
+ }
+
if (on_undef_flag != OnUndefinedFlag::kIgnoreUndefined) {
undefined_flag_names.emplace_back(arg_from_argv,
std::string(flag_name));
diff --git a/contrib/restricted/abseil-cpp/absl/flags/reflection.cc b/contrib/restricted/abseil-cpp/absl/flags/reflection.cc
index dbce4032ab..5dde972b1b 100644
--- a/contrib/restricted/abseil-cpp/absl/flags/reflection.cc
+++ b/contrib/restricted/abseil-cpp/absl/flags/reflection.cc
@@ -50,7 +50,7 @@ class FlagRegistry {
~FlagRegistry() = default;
// Store a flag in this registry. Takes ownership of *flag.
- void RegisterFlag(CommandLineFlag& flag, const char* filename);
+ void RegisterFlag(CommandLineFlag& flag, const char* filename);
void Lock() ABSL_EXCLUSIVE_LOCK_FUNCTION(lock_) { lock_.Lock(); }
void Unlock() ABSL_UNLOCK_FUNCTION(lock_) { lock_.Unlock(); }
@@ -110,20 +110,20 @@ CommandLineFlag* FlagRegistry::FindFlag(absl::string_view name) {
return it != flags_.end() ? it->second : nullptr;
}
-void FlagRegistry::RegisterFlag(CommandLineFlag& flag, const char* filename) {
- if (filename != nullptr &&
- flag.Filename() != GetUsageConfig().normalize_filename(filename)) {
- flags_internal::ReportUsageError(
- absl::StrCat(
- "Inconsistency between flag object and registration for flag '",
- flag.Name(),
- "', likely due to duplicate flags or an ODR violation. Relevant "
- "files: ",
- flag.Filename(), " and ", filename),
- true);
- std::exit(1);
- }
-
+void FlagRegistry::RegisterFlag(CommandLineFlag& flag, const char* filename) {
+ if (filename != nullptr &&
+ flag.Filename() != GetUsageConfig().normalize_filename(filename)) {
+ flags_internal::ReportUsageError(
+ absl::StrCat(
+ "Inconsistency between flag object and registration for flag '",
+ flag.Name(),
+ "', likely due to duplicate flags or an ODR violation. Relevant "
+ "files: ",
+ flag.Filename(), " and ", filename),
+ true);
+ std::exit(1);
+ }
+
FlagRegistryLock registry_lock(*this);
std::pair<FlagIterator, bool> ins =
@@ -188,8 +188,8 @@ void ForEachFlag(std::function<void(CommandLineFlag&)> visitor) {
// --------------------------------------------------------------------
-bool RegisterCommandLineFlag(CommandLineFlag& flag, const char* filename) {
- FlagRegistry::GlobalRegistry().RegisterFlag(flag, filename);
+bool RegisterCommandLineFlag(CommandLineFlag& flag, const char* filename) {
+ FlagRegistry::GlobalRegistry().RegisterFlag(flag, filename);
return true;
}
@@ -283,7 +283,7 @@ void Retire(const char* name, FlagFastTypeId type_id, char* buf) {
static_assert(alignof(RetiredFlagObj) == kRetiredFlagObjAlignment, "");
auto* flag = ::new (static_cast<void*>(buf))
flags_internal::RetiredFlagObj(name, type_id);
- FlagRegistry::GlobalRegistry().RegisterFlag(*flag, nullptr);
+ FlagRegistry::GlobalRegistry().RegisterFlag(*flag, nullptr);
}
// --------------------------------------------------------------------
@@ -345,7 +345,7 @@ CommandLineFlag* FindCommandLineFlag(absl::string_view name) {
absl::flat_hash_map<absl::string_view, absl::CommandLineFlag*> GetAllFlags() {
absl::flat_hash_map<absl::string_view, absl::CommandLineFlag*> res;
flags_internal::ForEachFlag([&](CommandLineFlag& flag) {
- if (!flag.IsRetired()) res.insert({flag.Name(), &flag});
+ if (!flag.IsRetired()) res.insert({flag.Name(), &flag});
});
return res;
}
diff --git a/contrib/restricted/abseil-cpp/absl/flags/reflection.h b/contrib/restricted/abseil-cpp/absl/flags/reflection.h
index e6baf5de4b..f38292b8db 100644
--- a/contrib/restricted/abseil-cpp/absl/flags/reflection.h
+++ b/contrib/restricted/abseil-cpp/absl/flags/reflection.h
@@ -64,7 +64,7 @@ absl::flat_hash_map<absl::string_view, absl::CommandLineFlag*> GetAllFlags();
// void MyFunc() {
// absl::FlagSaver fs;
// ...
-// absl::SetFlag(&FLAGS_myFlag, otherValue);
+// absl::SetFlag(&FLAGS_myFlag, otherValue);
// ...
// } // scope of FlagSaver left, flags return to previous state
//
diff --git a/contrib/restricted/abseil-cpp/absl/flags/reflection/ya.make b/contrib/restricted/abseil-cpp/absl/flags/reflection/ya.make
index f75bc1c67d..0936f25e48 100644
--- a/contrib/restricted/abseil-cpp/absl/flags/reflection/ya.make
+++ b/contrib/restricted/abseil-cpp/absl/flags/reflection/ya.make
@@ -10,7 +10,7 @@ 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/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
@@ -18,10 +18,10 @@ PEERDIR(
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
- contrib/restricted/abseil-cpp/absl/debugging
- contrib/restricted/abseil-cpp/absl/debugging/stacktrace
- contrib/restricted/abseil-cpp/absl/debugging/symbolize
- contrib/restricted/abseil-cpp/absl/demangle
+ contrib/restricted/abseil-cpp/absl/debugging
+ contrib/restricted/abseil-cpp/absl/debugging/stacktrace
+ contrib/restricted/abseil-cpp/absl/debugging/symbolize
+ contrib/restricted/abseil-cpp/absl/demangle
contrib/restricted/abseil-cpp/absl/flags/commandlineflag
contrib/restricted/abseil-cpp/absl/flags/internal/commandlineflag
contrib/restricted/abseil-cpp/absl/flags/internal/private_handle_accessor
@@ -43,7 +43,7 @@ PEERDIR(
contrib/restricted/abseil-cpp/absl/time
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_optional_access
contrib/restricted/abseil-cpp/absl/types/bad_variant_access
)
diff --git a/contrib/restricted/abseil-cpp/absl/flags/usage/ya.make b/contrib/restricted/abseil-cpp/absl/flags/usage/ya.make
index f6b243c84c..b5879008eb 100644
--- a/contrib/restricted/abseil-cpp/absl/flags/usage/ya.make
+++ b/contrib/restricted/abseil-cpp/absl/flags/usage/ya.make
@@ -33,7 +33,7 @@ PEERDIR(
contrib/restricted/abseil-cpp/absl/flags/reflection
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/hash/internal
contrib/restricted/abseil-cpp/absl/numeric
contrib/restricted/abseil-cpp/absl/profiling/internal/exponential_biased
contrib/restricted/abseil-cpp/absl/strings
diff --git a/contrib/restricted/abseil-cpp/absl/flags/usage_config.cc b/contrib/restricted/abseil-cpp/absl/flags/usage_config.cc
index 5d7426db31..acf437a90c 100644
--- a/contrib/restricted/abseil-cpp/absl/flags/usage_config.cc
+++ b/contrib/restricted/abseil-cpp/absl/flags/usage_config.cc
@@ -34,8 +34,8 @@ extern "C" {
// Additional report of fatal usage error message before we std::exit. Error is
// fatal if is_fatal argument to ReportUsageError is true.
-ABSL_ATTRIBUTE_WEAK void ABSL_INTERNAL_C_SYMBOL(
- AbslInternalReportFatalUsageError)(absl::string_view) {}
+ABSL_ATTRIBUTE_WEAK void ABSL_INTERNAL_C_SYMBOL(
+ AbslInternalReportFatalUsageError)(absl::string_view) {}
} // extern "C"
@@ -129,7 +129,7 @@ void ReportUsageError(absl::string_view msg, bool is_fatal) {
std::cerr << "ERROR: " << msg << std::endl;
if (is_fatal) {
- ABSL_INTERNAL_C_SYMBOL(AbslInternalReportFatalUsageError)(msg);
+ ABSL_INTERNAL_C_SYMBOL(AbslInternalReportFatalUsageError)(msg);
}
}
diff --git a/contrib/restricted/abseil-cpp/absl/flags/usage_config.h b/contrib/restricted/abseil-cpp/absl/flags/usage_config.h
index ded70300f0..5a1acaf9be 100644
--- a/contrib/restricted/abseil-cpp/absl/flags/usage_config.h
+++ b/contrib/restricted/abseil-cpp/absl/flags/usage_config.h
@@ -127,8 +127,8 @@ extern "C" {
// Additional report of fatal usage error message before we std::exit. Error is
// fatal if is_fatal argument to ReportUsageError is true.
-void ABSL_INTERNAL_C_SYMBOL(AbslInternalReportFatalUsageError)(
- absl::string_view);
+void ABSL_INTERNAL_C_SYMBOL(AbslInternalReportFatalUsageError)(
+ absl::string_view);
} // extern "C"
diff --git a/contrib/restricted/abseil-cpp/absl/flags/ya.make b/contrib/restricted/abseil-cpp/absl/flags/ya.make
index 983809b80c..ec1b324e17 100644
--- a/contrib/restricted/abseil-cpp/absl/flags/ya.make
+++ b/contrib/restricted/abseil-cpp/absl/flags/ya.make
@@ -1,20 +1,20 @@
-# Generated by devtools/yamaker.
-
-LIBRARY()
-
-OWNER(g:cpp-contrib)
-
-LICENSE(Apache-2.0)
-
+# Generated by devtools/yamaker.
+
+LIBRARY()
+
+OWNER(g:cpp-contrib)
+
+LICENSE(Apache-2.0)
+
LICENSE_TEXTS(.yandex_meta/licenses.list.txt)
-PEERDIR(
- contrib/restricted/abseil-cpp/absl/base
+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
@@ -32,9 +32,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
@@ -47,24 +47,24 @@ PEERDIR(
contrib/restricted/abseil-cpp/absl/time
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_optional_access
contrib/restricted/abseil-cpp/absl/types/bad_variant_access
-)
-
-ADDINCL(
- GLOBAL contrib/restricted/abseil-cpp
-)
-
-NO_COMPILER_WARNINGS()
-
-NO_UTIL()
-
-CFLAGS(
- -DNOMINMAX
-)
-
-SRCS(
+)
+
+ADDINCL(
+ GLOBAL contrib/restricted/abseil-cpp
+)
+
+NO_COMPILER_WARNINGS()
+
+NO_UTIL()
+
+CFLAGS(
+ -DNOMINMAX
+)
+
+SRCS(
flag.cc
-)
-
-END()
+)
+
+END()