diff options
author | thegeorg <thegeorg@yandex-team.com> | 2024-08-06 11:28:07 +0300 |
---|---|---|
committer | thegeorg <thegeorg@yandex-team.com> | 2024-08-06 12:50:21 +0300 |
commit | de4d7efd8871b850e3ea79164d7661e2299836b7 (patch) | |
tree | 47d8cf597b3789a807a4b1cec0a9fd66788767c2 /contrib/restricted/abseil-cpp-tstring/y_absl/base/nullability.h | |
parent | e003b4c129e1381591dcb75a96bf9a970b2b47fb (diff) | |
download | ydb-de4d7efd8871b850e3ea79164d7661e2299836b7.tar.gz |
Update contrib/restricted/abseil-cpp-tstring to 20240722.0
83a5727000e16bc5a94523a0cf1cce75fa86a191
Diffstat (limited to 'contrib/restricted/abseil-cpp-tstring/y_absl/base/nullability.h')
-rw-r--r-- | contrib/restricted/abseil-cpp-tstring/y_absl/base/nullability.h | 40 |
1 files changed, 33 insertions, 7 deletions
diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/base/nullability.h b/contrib/restricted/abseil-cpp-tstring/y_absl/base/nullability.h index 4930eb7ac5..cd5b21ac37 100644 --- a/contrib/restricted/abseil-cpp-tstring/y_absl/base/nullability.h +++ b/contrib/restricted/abseil-cpp-tstring/y_absl/base/nullability.h @@ -128,9 +128,17 @@ // // By default, nullability annotations are applicable to raw and smart // pointers. User-defined types can indicate compatibility with nullability -// annotations by providing an `absl_nullability_compatible` nested type. The -// actual definition of this inner type is not relevant as it is used merely as -// a marker. It is common to use a using declaration of +// annotations by adding the Y_ABSL_NULLABILITY_COMPATIBLE attribute. +// +// // Example: +// struct Y_ABSL_NULLABILITY_COMPATIBLE MyPtr { +// ... +// }; +// +// Note: For the time being, nullability-compatible classes should additionally +// be marked with an `absl_nullability_compatible` nested type (this will soon +// be deprecated). The actual definition of this inner type is not relevant as +// it is used merely as a marker. It is common to use a using declaration of // `absl_nullability_compatible` set to void. // // // Example: @@ -150,14 +158,16 @@ #ifndef Y_ABSL_BASE_NULLABILITY_H_ #define Y_ABSL_BASE_NULLABILITY_H_ +#include "y_absl/base/config.h" #include "y_absl/base/internal/nullability_impl.h" namespace y_absl { +Y_ABSL_NAMESPACE_BEGIN // y_absl::Nonnull // // The indicated pointer is never null. It is the responsibility of the provider -// of this pointer across an API boundary to ensure that the pointer is never be +// of this pointer across an API boundary to ensure that the pointer is never // set to null. Consumers of this pointer across an API boundary may safely // dereference the pointer. // @@ -198,9 +208,9 @@ using Nullable = nullability_internal::NullableImpl<T>; // migrated into one of the above two nullability states: `Nonnull<T>` or // `Nullable<T>`. // -// NOTE: Because this annotation is the global default state, pointers without -// any annotation are assumed to have "unknown" semantics. This assumption is -// designed to minimize churn and reduce clutter within the codebase. +// NOTE: Because this annotation is the global default state, unannotated +// pointers are assumed to have "unknown" semantics. This assumption is designed +// to minimize churn and reduce clutter within the codebase. // // Example: // @@ -219,6 +229,22 @@ using Nullable = nullability_internal::NullableImpl<T>; template <typename T> using NullabilityUnknown = nullability_internal::NullabilityUnknownImpl<T>; +Y_ABSL_NAMESPACE_END } // namespace y_absl +// Y_ABSL_NULLABILITY_COMPATIBLE +// +// Indicates that a class is compatible with nullability annotations. +// +// For example: +// +// struct Y_ABSL_NULLABILITY_COMPATIBLE MyPtr { +// ... +// }; +#if Y_ABSL_HAVE_FEATURE(nullability_on_classes) +#define Y_ABSL_NULLABILITY_COMPATIBLE _Nullable +#else +#define Y_ABSL_NULLABILITY_COMPATIBLE +#endif + #endif // Y_ABSL_BASE_NULLABILITY_H_ |