From 6acb60c161f1203e6eca929b87f2041da7714bfe Mon Sep 17 00:00:00 2001 From: Derek Mauro Date: Mon, 3 Oct 2022 07:26:24 -0700 Subject: [PATCH] Removes the legacy spellings of the thread annotation macros/functions by default. The compatibility macro `ABSL_LEGACY_THREAD_ANNOTATIONS` can be defined on the compile command-line to temporarily restore these spellings. All of the thread annotation macros are available under ABSL_ prefixed spellings in `absl/base/thread_annotations.h`. The compatibility macro and the legacy spellings will be removed in the future. See https://github.com/google/fuzztest/issues/41 PiperOrigin-RevId: 478498273 Change-Id: I120ad6480d031642bf95a11bf72ab883d9161810 --- absl/base/internal/thread_annotations.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/absl/base/internal/thread_annotations.h b/absl/base/internal/thread_annotations.h index 4dab6a9c150..8c5c67e0df2 100644 --- a/absl/base/internal/thread_annotations.h +++ b/absl/base/internal/thread_annotations.h @@ -38,6 +38,13 @@ #ifndef ABSL_BASE_INTERNAL_THREAD_ANNOTATIONS_H_ #define ABSL_BASE_INTERNAL_THREAD_ANNOTATIONS_H_ +// ABSL_LEGACY_THREAD_ANNOTATIONS is a *temporary* compatibility macro that can +// be defined on the compile command-line to restore the legacy spellings of the +// thread annotations macros/functions. The macros in this file are available +// under ABSL_ prefixed spellings in absl/base/thread_annotations.h. This macro +// and the legacy spellings will be removed in the future. +#ifdef ABSL_LEGACY_THREAD_ANNOTATIONS + #if defined(__clang__) #define THREAD_ANNOTATION_ATTRIBUTE__(x) __attribute__((x)) #else @@ -268,4 +275,6 @@ inline T& ts_unchecked_read(T& v) NO_THREAD_SAFETY_ANALYSIS { } // namespace thread_safety_analysis +#endif // defined(ABSL_LEGACY_THREAD_ANNOTATIONS) + #endif // ABSL_BASE_INTERNAL_THREAD_ANNOTATIONS_H_