Export of internal Abseil changes

--
7507caf944f8eb98e55730e60e77f9060c572788 by Derek Mauro <dmauro@google.com>:

Remove RunningOnValgrind() and ValgrindSlowdown() from dynamic_annotations.h

These are defined by some sanitizer implementations and possibly Valgrind.
Abseil decided to define them when the implementation was unavailable so
that they could be unconditionally called, but we now consider this a mistake.
Other libraries, including Python, have copied this method, leading to
multiple definitions when these libraries are used together.

In the unlikely case that code is using Abseil's definition, it
is recommended that the call be guarded instead:
```
#if __has_feature(thread_sanitizer)
extern "C" int RunningOnValgrind();
if (RunningOnValgrind()) ...
#endif
```

Fixes #1011

PiperOrigin-RevId: 394501460
GitOrigin-RevId: 7507caf944f8eb98e55730e60e77f9060c572788
Change-Id: I5ddaf9a590c857d645461352a0f6fbccbb3d5584
pull/1013/head
Abseil Team 3 years ago committed by vslashg
parent 4bb9e39c88
commit 6039dd95bb
  1. 25
      absl/base/dynamic_annotations.h

@ -433,31 +433,6 @@ ABSL_NAMESPACE_END
#endif
#ifdef __cplusplus
#ifdef ABSL_HAVE_THREAD_SANITIZER
ABSL_INTERNAL_BEGIN_EXTERN_C
int RunningOnValgrind();
double ValgrindSlowdown();
ABSL_INTERNAL_END_EXTERN_C
#else
namespace absl {
ABSL_NAMESPACE_BEGIN
namespace base_internal {
ABSL_DEPRECATED(
"Don't use this interface. It is misleading and is being deleted.")
ABSL_ATTRIBUTE_ALWAYS_INLINE inline int RunningOnValgrind() { return 0; }
ABSL_DEPRECATED(
"Don't use this interface. It is misleading and is being deleted.")
ABSL_ATTRIBUTE_ALWAYS_INLINE inline double ValgrindSlowdown() { return 1.0; }
} // namespace base_internal
ABSL_NAMESPACE_END
} // namespace absl
using absl::base_internal::RunningOnValgrind;
using absl::base_internal::ValgrindSlowdown;
#endif
#endif
// -------------------------------------------------------------------------
// Address sanitizer annotations

Loading…
Cancel
Save