diff options
author | nechda <nechda@yandex-team.com> | 2024-08-04 11:39:23 +0300 |
---|---|---|
committer | nechda <nechda@yandex-team.com> | 2024-08-04 11:57:57 +0300 |
commit | 55c4d6e43a8d293d088b2501098a802a40cade9a (patch) | |
tree | 0539a3b3981eff9cb22a8f7ba963e1b94cc96ddf /contrib | |
parent | ad701999eb5b93914c402b833230cf5f25958d46 (diff) | |
download | ydb-55c4d6e43a8d293d088b2501098a802a40cade9a.tar.gz |
Append Y_ prefix for ANNOTATE* macro
d0e25a75f327b12876f6c11ca30660f3b99a4c71
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/restricted/abseil-cpp-tstring/y_absl/base/internal/dynamic_annotations.h | 124 |
1 files changed, 62 insertions, 62 deletions
diff --git a/contrib/restricted/abseil-cpp-tstring/y_absl/base/internal/dynamic_annotations.h b/contrib/restricted/abseil-cpp-tstring/y_absl/base/internal/dynamic_annotations.h index 2ac2679133..7233cde126 100644 --- a/contrib/restricted/abseil-cpp-tstring/y_absl/base/internal/dynamic_annotations.h +++ b/contrib/restricted/abseil-cpp-tstring/y_absl/base/internal/dynamic_annotations.h @@ -21,7 +21,7 @@ // in the program. // // The annotations that should be used by users are macros in all upper-case -// (e.g., ANNOTATE_THREAD_NAME). +// (e.g., Y_ANNOTATE_THREAD_NAME). // // Actual implementation of these macros may differ depending on the dynamic // analysis tool being used. @@ -122,21 +122,21 @@ // Report that we may have a benign race at `pointer`, with size // "sizeof(*(pointer))". `pointer` must be a non-void* pointer. Insert at the // point where `pointer` has been allocated, preferably close to the point -// where the race happens. See also ANNOTATE_BENIGN_RACE_STATIC. -#define ANNOTATE_BENIGN_RACE(pointer, description) \ +// where the race happens. See also Y_ANNOTATE_BENIGN_RACE_STATIC. +#define Y_ANNOTATE_BENIGN_RACE(pointer, description) \ Y_ABSL_INTERNAL_GLOBAL_SCOPED(AnnotateBenignRaceSized) \ (__FILE__, __LINE__, pointer, sizeof(*(pointer)), description) -// Same as ANNOTATE_BENIGN_RACE(`address`, `description`), but applies to +// Same as Y_ANNOTATE_BENIGN_RACE(`address`, `description`), but applies to // the memory range [`address`, `address`+`size`). -#define ANNOTATE_BENIGN_RACE_SIZED(address, size, description) \ +#define Y_ANNOTATE_BENIGN_RACE_SIZED(address, size, description) \ Y_ABSL_INTERNAL_GLOBAL_SCOPED(AnnotateBenignRaceSized) \ (__FILE__, __LINE__, address, size, description) // Enable (`enable`!=0) or disable (`enable`==0) race detection for all threads. // This annotation could be useful if you want to skip expensive race analysis // during some period of program execution, e.g. during initialization. -#define ANNOTATE_ENABLE_RACE_DETECTION(enable) \ +#define Y_ANNOTATE_ENABLE_RACE_DETECTION(enable) \ Y_ABSL_INTERNAL_GLOBAL_SCOPED(AnnotateEnableRaceDetection) \ (__FILE__, __LINE__, enable) @@ -144,7 +144,7 @@ // Annotations useful for debugging. // Report the current thread `name` to a race detector. -#define ANNOTATE_THREAD_NAME(name) \ +#define Y_ANNOTATE_THREAD_NAME(name) \ Y_ABSL_INTERNAL_GLOBAL_SCOPED(AnnotateThreadName)(__FILE__, __LINE__, name) // ------------------------------------------------------------- @@ -153,41 +153,41 @@ // object. // Report that a lock has been created at address `lock`. -#define ANNOTATE_RWLOCK_CREATE(lock) \ +#define Y_ANNOTATE_RWLOCK_CREATE(lock) \ Y_ABSL_INTERNAL_GLOBAL_SCOPED(AnnotateRWLockCreate)(__FILE__, __LINE__, lock) // Report that a linker initialized lock has been created at address `lock`. #ifdef Y_ABSL_HAVE_THREAD_SANITIZER -#define ANNOTATE_RWLOCK_CREATE_STATIC(lock) \ +#define Y_ANNOTATE_RWLOCK_CREATE_STATIC(lock) \ Y_ABSL_INTERNAL_GLOBAL_SCOPED(AnnotateRWLockCreateStatic) \ (__FILE__, __LINE__, lock) #else -#define ANNOTATE_RWLOCK_CREATE_STATIC(lock) ANNOTATE_RWLOCK_CREATE(lock) +#define Y_ANNOTATE_RWLOCK_CREATE_STATIC(lock) Y_ANNOTATE_RWLOCK_CREATE(lock) #endif // Report that the lock at address `lock` is about to be destroyed. -#define ANNOTATE_RWLOCK_DESTROY(lock) \ +#define Y_ANNOTATE_RWLOCK_DESTROY(lock) \ Y_ABSL_INTERNAL_GLOBAL_SCOPED(AnnotateRWLockDestroy)(__FILE__, __LINE__, lock) // Report that the lock at address `lock` has been acquired. // `is_w`=1 for writer lock, `is_w`=0 for reader lock. -#define ANNOTATE_RWLOCK_ACQUIRED(lock, is_w) \ +#define Y_ANNOTATE_RWLOCK_ACQUIRED(lock, is_w) \ Y_ABSL_INTERNAL_GLOBAL_SCOPED(AnnotateRWLockAcquired) \ (__FILE__, __LINE__, lock, is_w) // Report that the lock at address `lock` is about to be released. // `is_w`=1 for writer lock, `is_w`=0 for reader lock. -#define ANNOTATE_RWLOCK_RELEASED(lock, is_w) \ +#define Y_ANNOTATE_RWLOCK_RELEASED(lock, is_w) \ Y_ABSL_INTERNAL_GLOBAL_SCOPED(AnnotateRWLockReleased) \ (__FILE__, __LINE__, lock, is_w) -// Apply ANNOTATE_BENIGN_RACE_SIZED to a static variable `static_var`. -#define ANNOTATE_BENIGN_RACE_STATIC(static_var, description) \ +// Apply Y_ANNOTATE_BENIGN_RACE_SIZED to a static variable `static_var`. +#define Y_ANNOTATE_BENIGN_RACE_STATIC(static_var, description) \ namespace { \ class static_var##_annotator { \ public: \ static_var##_annotator() { \ - ANNOTATE_BENIGN_RACE_SIZED(&static_var, sizeof(static_var), \ + Y_ANNOTATE_BENIGN_RACE_SIZED(&static_var, sizeof(static_var), \ #static_var ": " description); \ } \ }; \ @@ -196,16 +196,16 @@ #else // Y_ABSL_INTERNAL_RACE_ANNOTATIONS_ENABLED == 0 -#define ANNOTATE_RWLOCK_CREATE(lock) // empty -#define ANNOTATE_RWLOCK_CREATE_STATIC(lock) // empty -#define ANNOTATE_RWLOCK_DESTROY(lock) // empty -#define ANNOTATE_RWLOCK_ACQUIRED(lock, is_w) // empty -#define ANNOTATE_RWLOCK_RELEASED(lock, is_w) // empty -#define ANNOTATE_BENIGN_RACE(address, description) // empty -#define ANNOTATE_BENIGN_RACE_SIZED(address, size, description) // empty -#define ANNOTATE_THREAD_NAME(name) // empty -#define ANNOTATE_ENABLE_RACE_DETECTION(enable) // empty -#define ANNOTATE_BENIGN_RACE_STATIC(static_var, description) // empty +#define Y_ANNOTATE_RWLOCK_CREATE(lock) // empty +#define Y_ANNOTATE_RWLOCK_CREATE_STATIC(lock) // empty +#define Y_ANNOTATE_RWLOCK_DESTROY(lock) // empty +#define Y_ANNOTATE_RWLOCK_ACQUIRED(lock, is_w) // empty +#define Y_ANNOTATE_RWLOCK_RELEASED(lock, is_w) // empty +#define Y_ANNOTATE_BENIGN_RACE(address, description) // empty +#define Y_ANNOTATE_BENIGN_RACE_SIZED(address, size, description) // empty +#define Y_ANNOTATE_THREAD_NAME(name) // empty +#define Y_ANNOTATE_ENABLE_RACE_DETECTION(enable) // empty +#define Y_ANNOTATE_BENIGN_RACE_STATIC(static_var, description) // empty #endif // Y_ABSL_INTERNAL_RACE_ANNOTATIONS_ENABLED @@ -216,28 +216,28 @@ #include <sanitizer/msan_interface.h> -#define ANNOTATE_MEMORY_IS_INITIALIZED(address, size) \ +#define Y_ANNOTATE_MEMORY_IS_INITIALIZED(address, size) \ __msan_unpoison(address, size) -#define ANNOTATE_MEMORY_IS_UNINITIALIZED(address, size) \ +#define Y_ANNOTATE_MEMORY_IS_UNINITIALIZED(address, size) \ __msan_allocated_memory(address, size) #else // Y_ABSL_INTERNAL_MEMORY_ANNOTATIONS_ENABLED == 0 #if DYNAMIC_ANNOTATIONS_ENABLED == 1 -#define ANNOTATE_MEMORY_IS_INITIALIZED(address, size) \ +#define Y_ANNOTATE_MEMORY_IS_INITIALIZED(address, size) \ do { \ (void)(address); \ (void)(size); \ } while (0) -#define ANNOTATE_MEMORY_IS_UNINITIALIZED(address, size) \ +#define Y_ANNOTATE_MEMORY_IS_UNINITIALIZED(address, size) \ do { \ (void)(address); \ (void)(size); \ } while (0) #else -#define ANNOTATE_MEMORY_IS_INITIALIZED(address, size) // empty -#define ANNOTATE_MEMORY_IS_UNINITIALIZED(address, size) // empty +#define Y_ANNOTATE_MEMORY_IS_INITIALIZED(address, size) // empty +#define Y_ANNOTATE_MEMORY_IS_UNINITIALIZED(address, size) // empty #endif #endif // Y_ABSL_INTERNAL_MEMORY_ANNOTATIONS_ENABLED @@ -265,14 +265,14 @@ #if Y_ABSL_INTERNAL_READS_ANNOTATIONS_ENABLED == 1 // Request the analysis tool to ignore all reads in the current thread until -// ANNOTATE_IGNORE_READS_END is called. Useful to ignore intentional racey +// Y_ANNOTATE_IGNORE_READS_END is called. Useful to ignore intentional racey // reads, while still checking other reads and all writes. -// See also ANNOTATE_UNPROTECTED_READ. -#define ANNOTATE_IGNORE_READS_BEGIN() \ +// See also Y_ANNOTATE_UNPROTECTED_READ. +#define Y_ANNOTATE_IGNORE_READS_BEGIN() \ Y_ABSL_INTERNAL_GLOBAL_SCOPED(AnnotateIgnoreReadsBegin)(__FILE__, __LINE__) // Stop ignoring reads. -#define ANNOTATE_IGNORE_READS_END() \ +#define Y_ANNOTATE_IGNORE_READS_END() \ Y_ABSL_INTERNAL_GLOBAL_SCOPED(AnnotateIgnoreReadsEnd)(__FILE__, __LINE__) #elif defined(Y_ABSL_INTERNAL_ANNOTALYSIS_ENABLED) @@ -284,16 +284,16 @@ // TODO(delesley) -- The exclusive lock here ignores writes as well, but // allows IGNORE_READS_AND_WRITES to work properly. -#define ANNOTATE_IGNORE_READS_BEGIN() \ +#define Y_ANNOTATE_IGNORE_READS_BEGIN() \ Y_ABSL_INTERNAL_GLOBAL_SCOPED(AbslInternalAnnotateIgnoreReadsBegin)() -#define ANNOTATE_IGNORE_READS_END() \ +#define Y_ANNOTATE_IGNORE_READS_END() \ Y_ABSL_INTERNAL_GLOBAL_SCOPED(AbslInternalAnnotateIgnoreReadsEnd)() #else -#define ANNOTATE_IGNORE_READS_BEGIN() // empty -#define ANNOTATE_IGNORE_READS_END() // empty +#define Y_ANNOTATE_IGNORE_READS_BEGIN() // empty +#define Y_ANNOTATE_IGNORE_READS_END() // empty #endif @@ -302,60 +302,60 @@ #if Y_ABSL_INTERNAL_WRITES_ANNOTATIONS_ENABLED == 1 -// Similar to ANNOTATE_IGNORE_READS_BEGIN, but ignore writes instead. -#define ANNOTATE_IGNORE_WRITES_BEGIN() \ +// Similar to Y_ANNOTATE_IGNORE_READS_BEGIN, but ignore writes instead. +#define Y_ANNOTATE_IGNORE_WRITES_BEGIN() \ Y_ABSL_INTERNAL_GLOBAL_SCOPED(AnnotateIgnoreWritesBegin)(__FILE__, __LINE__) // Stop ignoring writes. -#define ANNOTATE_IGNORE_WRITES_END() \ +#define Y_ANNOTATE_IGNORE_WRITES_END() \ Y_ABSL_INTERNAL_GLOBAL_SCOPED(AnnotateIgnoreWritesEnd)(__FILE__, __LINE__) #else -#define ANNOTATE_IGNORE_WRITES_BEGIN() // empty -#define ANNOTATE_IGNORE_WRITES_END() // empty +#define Y_ANNOTATE_IGNORE_WRITES_BEGIN() // empty +#define Y_ANNOTATE_IGNORE_WRITES_END() // empty #endif // ------------------------------------------------------------------------- -// Define the ANNOTATE_IGNORE_READS_AND_WRITES_* annotations using the more +// Define the Y_ANNOTATE_IGNORE_READS_AND_WRITES_* annotations using the more // primitive annotations defined above. // // Instead of doing -// ANNOTATE_IGNORE_READS_BEGIN(); +// Y_ANNOTATE_IGNORE_READS_BEGIN(); // ... = x; -// ANNOTATE_IGNORE_READS_END(); +// Y_ANNOTATE_IGNORE_READS_END(); // one can use -// ... = ANNOTATE_UNPROTECTED_READ(x); +// ... = Y_ANNOTATE_UNPROTECTED_READ(x); #if defined(Y_ABSL_INTERNAL_READS_WRITES_ANNOTATIONS_ENABLED) // Start ignoring all memory accesses (both reads and writes). -#define ANNOTATE_IGNORE_READS_AND_WRITES_BEGIN() \ +#define Y_ANNOTATE_IGNORE_READS_AND_WRITES_BEGIN() \ do { \ - ANNOTATE_IGNORE_READS_BEGIN(); \ - ANNOTATE_IGNORE_WRITES_BEGIN(); \ + Y_ANNOTATE_IGNORE_READS_BEGIN(); \ + Y_ANNOTATE_IGNORE_WRITES_BEGIN(); \ } while (0) // Stop ignoring both reads and writes. -#define ANNOTATE_IGNORE_READS_AND_WRITES_END() \ +#define Y_ANNOTATE_IGNORE_READS_AND_WRITES_END() \ do { \ - ANNOTATE_IGNORE_WRITES_END(); \ - ANNOTATE_IGNORE_READS_END(); \ + Y_ANNOTATE_IGNORE_WRITES_END(); \ + Y_ANNOTATE_IGNORE_READS_END(); \ } while (0) #ifdef __cplusplus -// ANNOTATE_UNPROTECTED_READ is the preferred way to annotate racey reads. -#define ANNOTATE_UNPROTECTED_READ(x) \ +// Y_ANNOTATE_UNPROTECTED_READ is the preferred way to annotate racey reads. +#define Y_ANNOTATE_UNPROTECTED_READ(x) \ y_absl::base_internal::AnnotateUnprotectedRead(x) #endif #else -#define ANNOTATE_IGNORE_READS_AND_WRITES_BEGIN() // empty -#define ANNOTATE_IGNORE_READS_AND_WRITES_END() // empty -#define ANNOTATE_UNPROTECTED_READ(x) (x) +#define Y_ANNOTATE_IGNORE_READS_AND_WRITES_BEGIN() // empty +#define Y_ANNOTATE_IGNORE_READS_AND_WRITES_END() // empty +#define Y_ANNOTATE_UNPROTECTED_READ(x) (x) #endif @@ -368,7 +368,7 @@ // sanitizer/common_interface_defs.h, which is provided by the compiler. #include <sanitizer/common_interface_defs.h> -#define ANNOTATE_CONTIGUOUS_CONTAINER(beg, end, old_mid, new_mid) \ +#define Y_ANNOTATE_CONTIGUOUS_CONTAINER(beg, end, old_mid, new_mid) \ __sanitizer_annotate_contiguous_container(beg, end, old_mid, new_mid) #define ADDRESS_SANITIZER_REDZONE(name) \ struct { \ @@ -377,7 +377,7 @@ #else -#define ANNOTATE_CONTIGUOUS_CONTAINER(beg, end, old_mid, new_mid) +#define Y_ANNOTATE_CONTIGUOUS_CONTAINER(beg, end, old_mid, new_mid) #define ADDRESS_SANITIZER_REDZONE(name) static_assert(true, "") #endif // Y_ABSL_HAVE_ADDRESS_SANITIZER |