From fe6ec8efabe2ca1f6d68d6c14087cdd58ea07136 Mon Sep 17 00:00:00 2001 From: Derek Mauro Date: Thu, 19 Jan 2023 07:33:56 -0800 Subject: Only enable cordz on Linux with thread_local support Fixes #1365 PiperOrigin-RevId: 503160321 Change-Id: I210f194373c3e08a75d68298a8482be5f1f2227c --- absl/strings/internal/cordz_functions.h | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'absl/strings/internal') 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 -- cgit v1.2.3