Enable thread safety annotations in local bazel builds.

This is necessary as without this define, Apple's Clang complains about
googlebenchmark's code:

```
In file included from external/google_benchmark+/src/perf_counters.cc:15:
In file included from external/google_benchmark+/src/perf_counters.h:27:
external/google_benchmark+/src/mutex.h:79:40: error: mutex 'mut_' is still held at the end of function [-Werror,-Wthread-safety-analysis]
   79 |   void lock() ACQUIRE() { mut_.lock(); }
      |                                        ^
external/google_benchmark+/src/mutex.h:79:32: note: mutex acquired here
   79 |   void lock() ACQUIRE() { mut_.lock(); }
      |                                ^
external/google_benchmark+/src/mutex.h:80:34: error: releasing mutex 'mut_' that was not held [-Werror,-Wthread-safety-analysis]
   80 |   void unlock() RELEASE() { mut_.unlock(); }
      |                                  ^
2 errors generated.
Target //:bssl_bench failed to build
```

With this define, googlebenchmark's code uses its own annotations (here
`ACQUIRE` and `RELEASE`), which fixes the warnings, making `bazel test
...` work.

Change-Id: Iefe7e2ce1b48cde096a29854240c98da6a6a6964
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/99447
Reviewed-by: Adam Langley <agl@google.com>
Commit-Queue: Rudolf Polzer <rpolzer@google.com>
Presubmit-BoringSSL-Verified: boringssl-scoped@luci-project-accounts.iam.gserviceaccount.com <boringssl-scoped@luci-project-accounts.iam.gserviceaccount.com>
diff --git a/.bazelrc b/.bazelrc
index 803b785..4212682 100644
--- a/.bazelrc
+++ b/.bazelrc
@@ -39,6 +39,15 @@
 build:linux --cxxopt=-Werror
 build:macos --cxxopt=-Werror
 
+# Google Benchmark needs this flag enabled to not have warnings (which are
+# turned into errors above) in its Mutex code.
+#
+# Can remove when https://github.com/google/benchmark/issues/2263 is resolved
+# and our version of Google Benchmark is updated past the fix.
+#
+# Only enabled on macOS, as Linux defaults to GCC which doesn't support this.
+build:macos --cxxopt=-DHAVE_THREAD_SAFETY_ATTRIBUTES=1
+
 # Without setting a minimum macOS version, std::optional does not work.
 build:macos --cxxopt=-mmacosx-version-min=10.15