summaryrefslogtreecommitdiff
path: root/absl/strings/internal/cordz_functions.h
diff options
context:
space:
mode:
authorGravatar Derek Mauro <dmauro@google.com>2023-01-19 07:33:56 -0800
committerGravatar Copybara-Service <copybara-worker@google.com>2023-01-19 07:34:42 -0800
commitfe6ec8efabe2ca1f6d68d6c14087cdd58ea07136 (patch)
treec1374cb0fb3b129b5145664f87af1a3755f3c7bb /absl/strings/internal/cordz_functions.h
parent0a75e76bda94a45cf606e513f63a1e497b68e2f1 (diff)
Only enable cordz on Linux with thread_local support
Fixes #1365 PiperOrigin-RevId: 503160321 Change-Id: I210f194373c3e08a75d68298a8482be5f1f2227c
Diffstat (limited to 'absl/strings/internal/cordz_functions.h')
-rw-r--r--absl/strings/internal/cordz_functions.h16
1 files changed, 4 insertions, 12 deletions
diff --git a/absl/strings/internal/cordz_functions.h b/absl/strings/internal/cordz_functions.h
index 93f46ec6..ed108bf1 100644
--- a/absl/strings/internal/cordz_functions.h
+++ b/absl/strings/internal/cordz_functions.h
@@ -32,18 +32,10 @@ int32_t get_cordz_mean_interval();
// Sets the sample rate with the average interval between samples.
void set_cordz_mean_interval(int32_t mean_interval);
-// Enable cordz unless any of the following applies:
-// - no thread local support
-// - MSVC build
-// - Android build
-// - Apple build
-// - DLL build
-// Hashtablez is turned off completely in opensource builds.
-// MSVC's static atomics are dynamically initialized in debug mode, which breaks
-// sampling.
-#if defined(ABSL_HAVE_THREAD_LOCAL) && !defined(_MSC_VER) && \
- !defined(ABSL_BUILD_DLL) && !defined(ABSL_CONSUME_DLL) && \
- !defined(__ANDROID__) && !defined(__APPLE__)
+// Cordz is only enabled on Linux with thread_local support.
+#if defined(ABSL_INTERNAL_CORDZ_ENABLED)
+#error ABSL_INTERNAL_CORDZ_ENABLED cannot be set directly
+#elif defined(__linux__) && defined(ABSL_HAVE_THREAD_LOCAL)
#define ABSL_INTERNAL_CORDZ_ENABLED 1
#endif