Download weight/_dep/abseil-cpp/absl/base/dynamic_annotations.h from OneScience-Group/AlphaFold3: direct link, hf CLI and curl.
- Browser
- Download file 19.8 kB
-
https://huggingface.co/OneScience-Group/AlphaFold3/resolve/main/weight/_dep/abseil-cpp/absl/base/dynamic_annotations.h
- Command line
-
hf download hf://OneScience-Group/AlphaFold3/weight/_dep/abseil-cpp/absl/base/dynamic_annotations.h
-
curl -L -o dynamic_annotations.h https://huggingface.co/OneScience-Group/AlphaFold3/resolve/main/weight/_dep/abseil-cpp/absl/base/dynamic_annotations.h
19.8 kB
| // Copyright 2017 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. | |
| // This file defines dynamic annotations for use with dynamic analysis tool | |
| // such as valgrind, PIN, etc. | |
| // | |
| // Dynamic annotation is a source code annotation that affects the generated | |
| // code (that is, the annotation is not a comment). Each such annotation is | |
| // attached to a particular instruction and/or to a particular object (address) | |
| // in the program. | |
| // | |
| // The annotations that should be used by users are macros in all upper-case | |
| // (e.g., ABSL_ANNOTATE_THREAD_NAME). | |
| // | |
| // Actual implementation of these macros may differ depending on the dynamic | |
| // analysis tool being used. | |
| // | |
| // This file supports the following configurations: | |
| // - Dynamic Annotations enabled (with static thread-safety warnings disabled). | |
| // In this case, macros expand to functions implemented by Thread Sanitizer, | |
| // when building with TSan. When not provided an external implementation, | |
| // dynamic_annotations.cc provides no-op implementations. | |
| // | |
| // - Static Clang thread-safety warnings enabled. | |
| // When building with a Clang compiler that supports thread-safety warnings, | |
| // a subset of annotations can be statically-checked at compile-time. We | |
| // expand these macros to static-inline functions that can be analyzed for | |
| // thread-safety, but afterwards elided when building the final binary. | |
| // | |
| // - All annotations are disabled. | |
| // If neither Dynamic Annotations nor Clang thread-safety warnings are | |
| // enabled, then all annotation-macros expand to empty. | |
| // TODO(rogeeff): Remove after the backward compatibility period. | |
| // ------------------------------------------------------------------------- | |
| // Decide which features are enabled. | |
| // Clang provides limited support for static thread-safety analysis through a | |
| // feature called Annotalysis. We configure macro-definitions according to | |
| // whether Annotalysis support is available. When running in opt-mode, GCC | |
| // will issue a warning, if these attributes are compiled. Only include them | |
| // when compiling using Clang. | |
| // Read/write annotations are enabled in Annotalysis mode; disabled otherwise. | |
| // ------------------------------------------------------------------------- | |
| // Define race annotations. | |
| // Some of the symbols used in this section (e.g. AnnotateBenignRaceSized) are | |
| // defined by the compiler-based sanitizer implementation, not by the Abseil | |
| // library. Therefore they do not use ABSL_INTERNAL_C_SYMBOL. | |
| // ------------------------------------------------------------- | |
| // Annotations that suppress errors. It is usually better to express the | |
| // program's synchronization using the other annotations, but these can be used | |
| // when all else fails. | |
| // 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 ABSL_ANNOTATE_BENIGN_RACE_STATIC. | |
| // Same as ABSL_ANNOTATE_BENIGN_RACE(`address`, `description`), but applies to | |
| // the memory range [`address`, `address`+`size`). | |
| // 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. | |
| // ------------------------------------------------------------- | |
| // Annotations useful for debugging. | |
| // Report the current thread `name` to a race detector. | |
| // ------------------------------------------------------------- | |
| // Annotations useful when implementing locks. They are not normally needed by | |
| // modules that merely use locks. The `lock` argument is a pointer to the lock | |
| // object. | |
| // Report that a lock has been created at address `lock`. | |
| // Report that a linker initialized lock has been created at address `lock`. | |
| // Report that the lock at address `lock` is about to be destroyed. | |
| // Report that the lock at address `lock` has been acquired. | |
| // `is_w`=1 for writer lock, `is_w`=0 for reader lock. | |
| // Report that the lock at address `lock` is about to be released. | |
| // `is_w`=1 for writer lock, `is_w`=0 for reader lock. | |
| // Apply ABSL_ANNOTATE_BENIGN_RACE_SIZED to a static variable `static_var`. | |
| // Function prototypes of annotations provided by the compiler-based sanitizer | |
| // implementation. | |
| ABSL_INTERNAL_BEGIN_EXTERN_C | |
| void AnnotateRWLockCreate(const char* file, int line, | |
| const volatile void* lock); | |
| void AnnotateRWLockCreateStatic(const char* file, int line, | |
| const volatile void* lock); | |
| void AnnotateRWLockDestroy(const char* file, int line, | |
| const volatile void* lock); | |
| void AnnotateRWLockAcquired(const char* file, int line, | |
| const volatile void* lock, long is_w); // NOLINT | |
| void AnnotateRWLockReleased(const char* file, int line, | |
| const volatile void* lock, long is_w); // NOLINT | |
| void AnnotateBenignRace(const char* file, int line, | |
| const volatile void* address, const char* description); | |
| void AnnotateBenignRaceSized(const char* file, int line, | |
| const volatile void* address, size_t size, | |
| const char* description); | |
| void AnnotateThreadName(const char* file, int line, const char* name); | |
| void AnnotateEnableRaceDetection(const char* file, int line, int enable); | |
| ABSL_INTERNAL_END_EXTERN_C | |
| // ------------------------------------------------------------------------- | |
| // Define memory annotations. | |
| // TODO(rogeeff): remove this branch | |
| // ------------------------------------------------------------------------- | |
| // Define IGNORE_READS_BEGIN/_END attributes. | |
| // ------------------------------------------------------------------------- | |
| // Define IGNORE_READS_BEGIN/_END annotations. | |
| // Some of the symbols used in this section (e.g. AnnotateIgnoreReadsBegin) are | |
| // defined by the compiler-based implementation, not by the Abseil | |
| // library. Therefore they do not use ABSL_INTERNAL_C_SYMBOL. | |
| // Request the analysis tool to ignore all reads in the current thread until | |
| // ABSL_ANNOTATE_IGNORE_READS_END is called. Useful to ignore intentional racey | |
| // reads, while still checking other reads and all writes. | |
| // See also ABSL_ANNOTATE_UNPROTECTED_READ. | |
| // Stop ignoring reads. | |
| // Function prototypes of annotations provided by the compiler-based sanitizer | |
| // implementation. | |
| ABSL_INTERNAL_BEGIN_EXTERN_C | |
| void AnnotateIgnoreReadsBegin(const char* file, int line) | |
| ABSL_INTERNAL_IGNORE_READS_BEGIN_ATTRIBUTE; | |
| void AnnotateIgnoreReadsEnd(const char* file, | |
| int line) ABSL_INTERNAL_IGNORE_READS_END_ATTRIBUTE; | |
| ABSL_INTERNAL_END_EXTERN_C | |
| // When Annotalysis is enabled without Dynamic Annotations, the use of | |
| // static-inline functions allows the annotations to be read at compile-time, | |
| // while still letting the compiler elide the functions from the final build. | |
| // | |
| // TODO(delesley) -- The exclusive lock here ignores writes as well, but | |
| // allows IGNORE_READS_AND_WRITES to work properly. | |
| ABSL_INTERNAL_STATIC_INLINE void ABSL_INTERNAL_C_SYMBOL( | |
| AbslInternalAnnotateIgnoreReadsBegin)() | |
| ABSL_INTERNAL_IGNORE_READS_BEGIN_ATTRIBUTE {} | |
| ABSL_INTERNAL_STATIC_INLINE void ABSL_INTERNAL_C_SYMBOL( | |
| AbslInternalAnnotateIgnoreReadsEnd)() | |
| ABSL_INTERNAL_IGNORE_READS_END_ATTRIBUTE {} | |
| // ------------------------------------------------------------------------- | |
| // Define IGNORE_WRITES_BEGIN/_END annotations. | |
| // Similar to ABSL_ANNOTATE_IGNORE_READS_BEGIN, but ignore writes instead. | |
| // Stop ignoring writes. | |
| // Function prototypes of annotations provided by the compiler-based sanitizer | |
| // implementation. | |
| ABSL_INTERNAL_BEGIN_EXTERN_C | |
| void AnnotateIgnoreWritesBegin(const char* file, int line); | |
| void AnnotateIgnoreWritesEnd(const char* file, int line); | |
| ABSL_INTERNAL_END_EXTERN_C | |
| // ------------------------------------------------------------------------- | |
| // Define the ABSL_ANNOTATE_IGNORE_READS_AND_WRITES_* annotations using the more | |
| // primitive annotations defined above. | |
| // | |
| // Instead of doing | |
| // ABSL_ANNOTATE_IGNORE_READS_BEGIN(); | |
| // ... = x; | |
| // ABSL_ANNOTATE_IGNORE_READS_END(); | |
| // one can use | |
| // ... = ABSL_ANNOTATE_UNPROTECTED_READ(x); | |
| // Start ignoring all memory accesses (both reads and writes). | |
| // Stop ignoring both reads and writes. | |
| // ABSL_ANNOTATE_UNPROTECTED_READ is the preferred way to annotate racey reads. | |
| namespace absl { | |
| ABSL_NAMESPACE_BEGIN | |
| namespace base_internal { | |
| template <typename T> | |
| inline T AnnotateUnprotectedRead(const volatile T& x) { // NOLINT | |
| ABSL_ANNOTATE_IGNORE_READS_BEGIN(); | |
| T res = x; | |
| ABSL_ANNOTATE_IGNORE_READS_END(); | |
| return res; | |
| } | |
| } // namespace base_internal | |
| ABSL_NAMESPACE_END | |
| } // namespace absl | |
| // ------------------------------------------------------------------------- | |
| // Address sanitizer annotations | |
| // Describe the current state of a contiguous container such as e.g. | |
| // std::vector or std::string. For more details see | |
| // sanitizer/common_interface_defs.h, which is provided by the compiler. | |
| // ------------------------------------------------------------------------- | |
| // HWAddress sanitizer annotations | |
| namespace absl { | |
| // Under HWASAN changes the tag of the pointer. | |
| template <typename T> | |
| T* HwasanTagPointer(T* ptr, uintptr_t tag) { | |
| return reinterpret_cast<T*>(__hwasan_tag_pointer(ptr, tag)); | |
| } | |
| template <typename T> | |
| T* HwasanTagPointer(T* ptr, uintptr_t) { | |
| return ptr; | |
| } | |
| } // namespace absl | |
| // ------------------------------------------------------------------------- | |
| // Undefine the macros intended only for this file. | |