summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Derek Mauro <dmauro@google.com>2022-10-03 07:26:24 -0700
committerGravatar Copybara-Service <copybara-worker@google.com>2022-10-03 07:27:12 -0700
commit6acb60c161f1203e6eca929b87f2041da7714bfe (patch)
treee528307c36b2d34d8642b7460f569d017a5408b5
parent7f3c0d781134d25b24e0b55346482a2d366bf59b (diff)
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
-rw-r--r--absl/base/internal/thread_annotations.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/absl/base/internal/thread_annotations.h b/absl/base/internal/thread_annotations.h
index 4dab6a9c..8c5c67e0 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_