From b7080b8b1d4beef93e5cd7afd5bce820c0f6b4c8 Mon Sep 17 00:00:00 2001 From: Kirill Timofeev Date: Fri, 1 Nov 2024 19:30:02 +0000 Subject: [PATCH] Enable Thread Safety Annotations for Perfetto standalone builds. Import build file located in "//gn/standalone/" only for the standalone builds. This fixes the Chromium build (Chromium can't depend on "//gn/standalone/"). Add "&& !is_perfetto_build_generator" to the "perfetto_thread_safety_annotations" argument computation. This fixes google3 build. Bug: 236942309 Change-Id: I81c2fd5c8d38ac9a89a45a03d5fe6140f89bbfb1 --- gn/perfetto.gni | 5 +++-- .../perfetto/base/build_configs/bazel/perfetto_build_flags.h | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/gn/perfetto.gni b/gn/perfetto.gni index f51a331da3..987d347378 100644 --- a/gn/perfetto.gni +++ b/gn/perfetto.gni @@ -13,7 +13,6 @@ # limitations under the License. import("//build_overrides/build.gni") -import("//gn/standalone/libc++/libc++.gni") import("wasm_vars.gni") # Summary of our typical build configurations: @@ -109,6 +108,7 @@ perfetto_build_standalone = if (perfetto_build_standalone || is_perfetto_build_generator) { perfetto_root_path = "//" import("//gn/standalone/android.gni") # For android_api_level + import("//gn/standalone/libc++/libc++.gni") # For use_custom_libcxx import("//gn/standalone/sanitizers/vars.gni") # For is_fuzzer } else if (!defined(perfetto_root_path)) { perfetto_root_path = "//third_party/perfetto/" @@ -250,7 +250,8 @@ declare_args() { # Enables complie-time thread safety analysis. perfetto_thread_safety_annotations = - use_custom_libcxx && perfetto_build_standalone + perfetto_build_standalone && !is_perfetto_build_generator && + defined(use_custom_libcxx) && use_custom_libcxx } declare_args() { diff --git a/include/perfetto/base/build_configs/bazel/perfetto_build_flags.h b/include/perfetto/base/build_configs/bazel/perfetto_build_flags.h index 30807c1c17..c27eaf8b62 100644 --- a/include/perfetto/base/build_configs/bazel/perfetto_build_flags.h +++ b/include/perfetto/base/build_configs/bazel/perfetto_build_flags.h @@ -47,7 +47,7 @@ #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_X64_CPU_OPT() (0) #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_LLVM_DEMANGLE() (1) #define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_SYSTEM_CONSUMER() (1) -#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_THREAD_SAFETY_ANNOTATIONS() (1) +#define PERFETTO_BUILDFLAG_DEFINE_PERFETTO_THREAD_SAFETY_ANNOTATIONS() (0) // clang-format on #endif // GEN_BUILD_CONFIG_PERFETTO_BUILD_FLAGS_H_