From e0b933b74d38daf65648f59ae11bc5b44b849c95 Mon Sep 17 00:00:00 2001 From: Josh Gao Date: Wed, 26 Apr 2017 20:26:14 -0700 Subject: [PATCH] Globally enable libcxx's thread safety annotations. Add -D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS to clang extra cppflags to make libcxx always emit thread safety annotations. Note that this won't generate additional warnings on projects that don't already use -Wthread-safety. Test: treehugger Change-Id: I517a96571d77be119510c981bc2cbaddb41dee95 --- cc/config/clang.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cc/config/clang.go b/cc/config/clang.go index 30ab1c63c..3ff6b1bf7 100644 --- a/cc/config/clang.go +++ b/cc/config/clang.go @@ -105,6 +105,11 @@ func init() { // Bug: http://b/29823425 Disable -Wnull-dereference until the // new instances detected by this warning are fixed. "-Wno-null-dereference", + + // Enable clang's thread-safety annotations in libcxx. + // Turn off -Wthread-safety-negative, to avoid breaking projects that use -Weverything. + "-D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS", + "-Wno-thread-safety-negative", }, " ")) pctx.StaticVariable("ClangExtraTargetCflags", strings.Join([]string{