diff options
author | prime <prime@yandex-team.ru> | 2022-02-10 16:46:01 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:01 +0300 |
commit | e34f3f0e381020a427f44fbd50463d9a04089db3 (patch) | |
tree | 1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /contrib/restricted/abseil-cpp/absl/status | |
parent | 3695a7cd42b74a4987d8d5a8f2e2443556998943 (diff) | |
download | ydb-e34f3f0e381020a427f44fbd50463d9a04089db3.tar.gz |
Restoring authorship annotation for <prime@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/restricted/abseil-cpp/absl/status')
6 files changed, 148 insertions, 148 deletions
diff --git a/contrib/restricted/abseil-cpp/absl/status/internal/status_internal.h b/contrib/restricted/abseil-cpp/absl/status/internal/status_internal.h index 9a3a8df838..ac12940a6d 100644 --- a/contrib/restricted/abseil-cpp/absl/status/internal/status_internal.h +++ b/contrib/restricted/abseil-cpp/absl/status/internal/status_internal.h @@ -19,20 +19,20 @@ #include "absl/container/inlined_vector.h" #include "absl/strings/cord.h" -#ifndef SWIG -// Disabled for SWIG as it doesn't parse attributes correctly. +#ifndef SWIG +// Disabled for SWIG as it doesn't parse attributes correctly. +namespace absl { +ABSL_NAMESPACE_BEGIN +// Returned Status objects may not be ignored. Codesearch doesn't handle ifdefs +// as part of a class definitions (b/6995610), so we use a forward declaration. +class ABSL_MUST_USE_RESULT Status; +ABSL_NAMESPACE_END +} // namespace absl +#endif // !SWIG + namespace absl { ABSL_NAMESPACE_BEGIN -// Returned Status objects may not be ignored. Codesearch doesn't handle ifdefs -// as part of a class definitions (b/6995610), so we use a forward declaration. -class ABSL_MUST_USE_RESULT Status; -ABSL_NAMESPACE_END -} // namespace absl -#endif // !SWIG -namespace absl { -ABSL_NAMESPACE_BEGIN - enum class StatusCode : int; namespace status_internal { @@ -49,11 +49,11 @@ using Payloads = absl::InlinedVector<Payload, 1>; struct StatusRep { StatusRep(absl::StatusCode code_arg, absl::string_view message_arg, std::unique_ptr<status_internal::Payloads> payloads_arg) - : ref(int32_t{1}), + : ref(int32_t{1}), code(code_arg), message(message_arg), payloads(std::move(payloads_arg)) {} - + std::atomic<int32_t> ref; absl::StatusCode code; std::string message; diff --git a/contrib/restricted/abseil-cpp/absl/status/internal/statusor_internal.h b/contrib/restricted/abseil-cpp/absl/status/internal/statusor_internal.h index 668c1b00ed..eaac2c0b14 100644 --- a/contrib/restricted/abseil-cpp/absl/status/internal/statusor_internal.h +++ b/contrib/restricted/abseil-cpp/absl/status/internal/statusor_internal.h @@ -17,7 +17,7 @@ #include <type_traits> #include <utility> -#include "absl/base/attributes.h" +#include "absl/base/attributes.h" #include "absl/meta/type_traits.h" #include "absl/status/status.h" #include "absl/utility/utility.h" @@ -136,14 +136,14 @@ class Helper { public: // Move type-agnostic error handling to the .cc. static void HandleInvalidStatusCtorArg(Status*); - ABSL_ATTRIBUTE_NORETURN static void Crash(const absl::Status& status); + ABSL_ATTRIBUTE_NORETURN static void Crash(const absl::Status& status); }; // Construct an instance of T in `p` through placement new, passing Args... to // the constructor. // This abstraction is here mostly for the gcc performance fix. template <typename T, typename... Args> -ABSL_ATTRIBUTE_NONNULL(1) void PlacementNew(void* p, Args&&... args) { +ABSL_ATTRIBUTE_NONNULL(1) void PlacementNew(void* p, Args&&... args) { new (p) T(std::forward<Args>(args)...); } diff --git a/contrib/restricted/abseil-cpp/absl/status/status.cc b/contrib/restricted/abseil-cpp/absl/status/status.cc index 04aeefb216..bcf3413e5f 100644 --- a/contrib/restricted/abseil-cpp/absl/status/status.cc +++ b/contrib/restricted/abseil-cpp/absl/status/status.cc @@ -283,27 +283,27 @@ bool Status::EqualsSlow(const absl::Status& a, const absl::Status& b) { return true; } -std::string Status::ToStringSlow(StatusToStringMode mode) const { +std::string Status::ToStringSlow(StatusToStringMode mode) const { std::string text; absl::StrAppend(&text, absl::StatusCodeToString(code()), ": ", message()); - const bool with_payload = (mode & StatusToStringMode::kWithPayload) == - StatusToStringMode::kWithPayload; - - if (with_payload) { - status_internal::StatusPayloadPrinter printer = - status_internal::GetStatusPayloadPrinter(); - this->ForEachPayload([&](absl::string_view type_url, - const absl::Cord& payload) { - absl::optional<std::string> result; - if (printer) result = printer(type_url, payload); - absl::StrAppend( - &text, " [", type_url, "='", - result.has_value() ? *result : absl::CHexEscape(std::string(payload)), - "']"); - }); - } - + const bool with_payload = (mode & StatusToStringMode::kWithPayload) == + StatusToStringMode::kWithPayload; + + if (with_payload) { + status_internal::StatusPayloadPrinter printer = + status_internal::GetStatusPayloadPrinter(); + this->ForEachPayload([&](absl::string_view type_url, + const absl::Cord& payload) { + absl::optional<std::string> result; + if (printer) result = printer(type_url, payload); + absl::StrAppend( + &text, " [", type_url, "='", + result.has_value() ? *result : absl::CHexEscape(std::string(payload)), + "']"); + }); + } + return text; } diff --git a/contrib/restricted/abseil-cpp/absl/status/status.h b/contrib/restricted/abseil-cpp/absl/status/status.h index d43f526336..39071e5f4a 100644 --- a/contrib/restricted/abseil-cpp/absl/status/status.h +++ b/contrib/restricted/abseil-cpp/absl/status/status.h @@ -58,7 +58,7 @@ #include "absl/functional/function_ref.h" #include "absl/status/internal/status_internal.h" #include "absl/strings/cord.h" -#include "absl/strings/string_view.h" +#include "absl/strings/string_view.h" #include "absl/types/optional.h" namespace absl { @@ -282,59 +282,59 @@ std::string StatusCodeToString(StatusCode code); // Streams StatusCodeToString(code) to `os`. std::ostream& operator<<(std::ostream& os, StatusCode code); -// absl::StatusToStringMode -// -// An `absl::StatusToStringMode` is an enumerated type indicating how +// absl::StatusToStringMode +// +// An `absl::StatusToStringMode` is an enumerated type indicating how // `absl::Status::ToString()` should construct the output string for a non-ok -// status. -enum class StatusToStringMode : int { - // ToString will not contain any extra data (such as payloads). It will only - // contain the error code and message, if any. - kWithNoExtraData = 0, - // ToString will contain the payloads. - kWithPayload = 1 << 0, - // ToString will include all the extra data this Status has. - kWithEverything = ~kWithNoExtraData, +// status. +enum class StatusToStringMode : int { + // ToString will not contain any extra data (such as payloads). It will only + // contain the error code and message, if any. + kWithNoExtraData = 0, + // ToString will contain the payloads. + kWithPayload = 1 << 0, + // ToString will include all the extra data this Status has. + kWithEverything = ~kWithNoExtraData, // Default mode used by ToString. Its exact value might change in the future. kDefault = kWithPayload, -}; - -// absl::StatusToStringMode is specified as a bitmask type, which means the -// following operations must be provided: -inline constexpr StatusToStringMode operator&(StatusToStringMode lhs, - StatusToStringMode rhs) { - return static_cast<StatusToStringMode>(static_cast<int>(lhs) & - static_cast<int>(rhs)); -} -inline constexpr StatusToStringMode operator|(StatusToStringMode lhs, - StatusToStringMode rhs) { - return static_cast<StatusToStringMode>(static_cast<int>(lhs) | - static_cast<int>(rhs)); -} -inline constexpr StatusToStringMode operator^(StatusToStringMode lhs, - StatusToStringMode rhs) { - return static_cast<StatusToStringMode>(static_cast<int>(lhs) ^ - static_cast<int>(rhs)); -} -inline constexpr StatusToStringMode operator~(StatusToStringMode arg) { - return static_cast<StatusToStringMode>(~static_cast<int>(arg)); -} -inline StatusToStringMode& operator&=(StatusToStringMode& lhs, - StatusToStringMode rhs) { - lhs = lhs & rhs; - return lhs; -} -inline StatusToStringMode& operator|=(StatusToStringMode& lhs, - StatusToStringMode rhs) { - lhs = lhs | rhs; - return lhs; -} -inline StatusToStringMode& operator^=(StatusToStringMode& lhs, - StatusToStringMode rhs) { - lhs = lhs ^ rhs; - return lhs; -} - +}; + +// absl::StatusToStringMode is specified as a bitmask type, which means the +// following operations must be provided: +inline constexpr StatusToStringMode operator&(StatusToStringMode lhs, + StatusToStringMode rhs) { + return static_cast<StatusToStringMode>(static_cast<int>(lhs) & + static_cast<int>(rhs)); +} +inline constexpr StatusToStringMode operator|(StatusToStringMode lhs, + StatusToStringMode rhs) { + return static_cast<StatusToStringMode>(static_cast<int>(lhs) | + static_cast<int>(rhs)); +} +inline constexpr StatusToStringMode operator^(StatusToStringMode lhs, + StatusToStringMode rhs) { + return static_cast<StatusToStringMode>(static_cast<int>(lhs) ^ + static_cast<int>(rhs)); +} +inline constexpr StatusToStringMode operator~(StatusToStringMode arg) { + return static_cast<StatusToStringMode>(~static_cast<int>(arg)); +} +inline StatusToStringMode& operator&=(StatusToStringMode& lhs, + StatusToStringMode rhs) { + lhs = lhs & rhs; + return lhs; +} +inline StatusToStringMode& operator|=(StatusToStringMode& lhs, + StatusToStringMode rhs) { + lhs = lhs | rhs; + return lhs; +} +inline StatusToStringMode& operator^=(StatusToStringMode& lhs, + StatusToStringMode rhs) { + lhs = lhs ^ rhs; + return lhs; +} + // absl::Status // // The `absl::Status` class is generally used to gracefully handle errors @@ -416,12 +416,12 @@ inline StatusToStringMode& operator^=(StatusToStringMode& lhs, // return result; // } // -// For documentation see https://abseil.io/docs/cpp/guides/status. -// -// Returned Status objects may not be ignored. status_internal.h has a forward -// declaration of the form -// class ABSL_MUST_USE_RESULT Status; -class Status final { +// For documentation see https://abseil.io/docs/cpp/guides/status. +// +// Returned Status objects may not be ignored. status_internal.h has a forward +// declaration of the form +// class ABSL_MUST_USE_RESULT Status; +class Status final { public: // Constructors @@ -431,10 +431,10 @@ class Status final { Status(); // Creates a status in the canonical error space with the specified - // `absl::StatusCode` and error message. If `code == absl::StatusCode::kOk`, // NOLINT + // `absl::StatusCode` and error message. If `code == absl::StatusCode::kOk`, // NOLINT // `msg` is ignored and an object identical to an OK status is constructed. // - // The `msg` string must be in UTF-8. The implementation may complain (e.g., // NOLINT + // The `msg` string must be in UTF-8. The implementation may complain (e.g., // NOLINT // by printing a warning) if it is not. Status(absl::StatusCode code, absl::string_view msg); @@ -503,16 +503,16 @@ class Status final { // Status::ToString() // - // Returns a string based on the `mode`. By default, it returns combination of - // the error code name, the message and any associated payload messages. This - // string is designed simply to be human readable and its exact format should - // not be load bearing. Do not depend on the exact format of the result of - // `ToString()` which is subject to change. + // Returns a string based on the `mode`. By default, it returns combination of + // the error code name, the message and any associated payload messages. This + // string is designed simply to be human readable and its exact format should + // not be load bearing. Do not depend on the exact format of the result of + // `ToString()` which is subject to change. // // The printed code name and the message are generally substrings of the // result, and the payloads to be printed use the status payload printer // mechanism (which is internal). - std::string ToString( + std::string ToString( StatusToStringMode mode = StatusToStringMode::kDefault) const; // Status::IgnoreError() @@ -613,9 +613,9 @@ class Status final { status_internal::Payloads* GetPayloads(); // Takes ownership of payload. - static uintptr_t NewRep( - absl::StatusCode code, absl::string_view msg, - std::unique_ptr<status_internal::Payloads> payload); + static uintptr_t NewRep( + absl::StatusCode code, absl::string_view msg, + std::unique_ptr<status_internal::Payloads> payload); static bool EqualsSlow(const absl::Status& a, const absl::Status& b); // MSVC 14.0 limitation requires the const. @@ -644,7 +644,7 @@ class Status final { static uintptr_t PointerToRep(status_internal::StatusRep* r); static status_internal::StatusRep* RepToPointer(uintptr_t r); - std::string ToStringSlow(StatusToStringMode mode) const; + std::string ToStringSlow(StatusToStringMode mode) const; // Status supports two different representations. // - When the low bit is off it is an inlined representation. @@ -767,11 +767,11 @@ inline Status::Status(Status&& x) noexcept : rep_(x.rep_) { inline Status& Status::operator=(Status&& x) { uintptr_t old_rep = rep_; - if (x.rep_ != old_rep) { - rep_ = x.rep_; - x.rep_ = MovedFromRep(); - Unref(old_rep); - } + if (x.rep_ != old_rep) { + rep_ = x.rep_; + x.rep_ = MovedFromRep(); + Unref(old_rep); + } return *this; } @@ -808,8 +808,8 @@ inline bool operator!=(const Status& lhs, const Status& rhs) { return !(lhs == rhs); } -inline std::string Status::ToString(StatusToStringMode mode) const { - return ok() ? "OK" : ToStringSlow(mode); +inline std::string Status::ToString(StatusToStringMode mode) const { + return ok() ? "OK" : ToStringSlow(mode); } inline void Status::IgnoreError() const { diff --git a/contrib/restricted/abseil-cpp/absl/status/statusor.h b/contrib/restricted/abseil-cpp/absl/status/statusor.h index f6eaf41703..c051fbb3aa 100644 --- a/contrib/restricted/abseil-cpp/absl/status/statusor.h +++ b/contrib/restricted/abseil-cpp/absl/status/statusor.h @@ -145,7 +145,7 @@ class ABSL_MUST_USE_RESULT StatusOr; // // NOTE: using `absl::StatusOr<T>::value()` when no valid value is present will // throw an exception if exceptions are enabled or terminate the process when -// exceptions are not enabled. +// exceptions are not enabled. // // Example: // @@ -550,7 +550,7 @@ class StatusOr : private internal_statusor::StatusOrData<T>, // StatusOr<T>::value_or() // - // Returns the current value if `this->ok() == true`. Otherwise constructs a + // Returns the current value if `this->ok() == true`. Otherwise constructs a // value using the provided `default_value`. // // Unlike `value`, this function returns by value, copying the current value diff --git a/contrib/restricted/abseil-cpp/absl/status/statusor/ya.make b/contrib/restricted/abseil-cpp/absl/status/statusor/ya.make index 5c4e185687..9628fcdffb 100644 --- a/contrib/restricted/abseil-cpp/absl/status/statusor/ya.make +++ b/contrib/restricted/abseil-cpp/absl/status/statusor/ya.make @@ -1,28 +1,28 @@ -# 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 contrib/restricted/abseil-cpp/absl/demangle - 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/status - 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 @@ -35,26 +35,26 @@ 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 -) - +) + +ADDINCL( + GLOBAL contrib/restricted/abseil-cpp +) + +NO_COMPILER_WARNINGS() + +NO_UTIL() + +CFLAGS( + -DNOMINMAX +) + SRCDIR(contrib/restricted/abseil-cpp/absl/status) - -SRCS( + +SRCS( statusor.cc -) - -END() +) + +END() |