Commit 45bfb66a authored by Mirko Bonadei's avatar Mirko Bonadei Committed by Commit Bot

Prefixing all the dynamic_annotations function to avoid ODR violations.

WebRTC trybots are detecting more ODR violations in dynamic_annotations:
https://build.chromium.org/p/tryserver.webrtc/builders/android_compile_x64_dbg/builds/27341

Bug: webrtc:8821
Change-Id: I2cfa4770b6dbfdb3419431d72de914f5a538fd82
Reviewed-on: https://chromium-review.googlesource.com/1009912
Commit-Queue: Mirko Bonadei <mbonadei@chromium.org>
Reviewed-by: default avatarPatrik Höglund <phoglund@chromium.org>
Cr-Commit-Position: refs/heads/master@{#550551}
parent f8856acf
...@@ -20,11 +20,24 @@ How to update Abseil: ...@@ -20,11 +20,24 @@ How to update Abseil:
4. Generate BUILD.gn files launching bazel_to_gn.py from //third_party/abseil-cpp. 4. Generate BUILD.gn files launching bazel_to_gn.py from //third_party/abseil-cpp.
5. Rename RunningOnValgrind to AbslRunningOnValgrind: 5. Rename functions in absl/base/dynamic_annotations.{h,cc}
find . -type f -exec sed -i "s/RunningOnValgrind/AbslRunningOnValgrind/g" {} \; find . -type f -exec sed -i "s/ValgrindSlowdown(/AbslValgrindSlowdown(/g" {} \;
find . -type f -exec sed -i "s/RunningOnValgrind(/AbslRunningOnValgrind(/g" {} \;
6. Rename ValgrindSlowdown to AbslValgrindSlowdown: find . -type f -exec sed -i "s/AnnotateBenignRace(/AbslAnnotateBenignRace(/g" {} \;
find . -type f -exec sed -i "s/ValgrindSlowdown/AbslValgrindSlowdown/g" {} \; find . -type f -exec sed -i "s/AnnotateBenignRaceSized(/AbslAnnotateBenignRaceSized(/g" {} \;
find . -type f -exec sed -i "s/AnnotateEnableRaceDetection(/AbslAnnotateEnableRaceDetection(/g" {} \;
find . -type f -exec sed -i "s/AnnotateIgnoreReadsBegin(/AbslAnnotateIgnoreReadsBegin(/g" {} \;
find . -type f -exec sed -i "s/AnnotateIgnoreReadsEnd(/AbslAnnotateIgnoreReadsEnd(/g" {} \;
find . -type f -exec sed -i "s/AnnotateIgnoreWritesBegin(/AbslAnnotateIgnoreWritesBegin(/g" {} \;
find . -type f -exec sed -i "s/AnnotateIgnoreWritesEnd(/AbslAnnotateIgnoreWritesEnd(/g" {} \;
find . -type f -exec sed -i "s/AnnotateRWLockAcquired(/AbslAnnotateRWLockAcquired(/g" {} \;
find . -type f -exec sed -i "s/AnnotateRWLockCreate(/AbslAnnotateRWLockCreate(/g" {} \;
find . -type f -exec sed -i "s/AnnotateRWLockDestroy(/AbslAnnotateRWLockDestroy(/g" {} \;
find . -type f -exec sed -i "s/AnnotateRWLockReleased(/AbslAnnotateRWLockReleased(/g" {} \;
find . -type f -exec sed -i "s/AnnotateThreadName(/AbslAnnotateThreadName(/g" {} \;
find . -type f -exec sed -i "s/AnnotateRWLockCreateStatic(/AbslAnnotateRWLockCreateStatic(/g" {} \;
find . -type f -exec sed -i "s/AnnotateMemoryIsInitialized(/AbslAnnotateMemoryIsInitialized(/g" {} \;
find . -type f -exec sed -i "s/AnnotateMemoryIsUninitialized(/AbslAnnotateMemoryIsUninitialized(/g" {} \;
Local Modifications: Local Modifications:
...@@ -33,7 +46,8 @@ Local Modifications: ...@@ -33,7 +46,8 @@ Local Modifications:
* All the BUILD.bazel files has been translated to BUILD.gn files. * All the BUILD.bazel files has been translated to BUILD.gn files.
* RunningOnValgrind and ValgrindSlowdown have been renamed to avoid ODR violations. * Functions in absl/base/dynamic_annotations.{h,cc} have been renamed to avoid
ODR violations.
...@@ -42,29 +42,29 @@ ...@@ -42,29 +42,29 @@
extern "C" { extern "C" {
#endif #endif
void AnnotateRWLockCreate(const char *, int, void AbslAnnotateRWLockCreate(const char *, int,
const volatile void *){} const volatile void *){}
void AnnotateRWLockDestroy(const char *, int, void AbslAnnotateRWLockDestroy(const char *, int,
const volatile void *){} const volatile void *){}
void AnnotateRWLockAcquired(const char *, int, void AbslAnnotateRWLockAcquired(const char *, int,
const volatile void *, long){} const volatile void *, long){}
void AnnotateRWLockReleased(const char *, int, void AbslAnnotateRWLockReleased(const char *, int,
const volatile void *, long){} const volatile void *, long){}
void AnnotateBenignRace(const char *, int, void AbslAnnotateBenignRace(const char *, int,
const volatile void *, const volatile void *,
const char *){} const char *){}
void AnnotateBenignRaceSized(const char *, int, void AbslAnnotateBenignRaceSized(const char *, int,
const volatile void *, const volatile void *,
size_t, size_t,
const char *) {} const char *) {}
void AnnotateThreadName(const char *, int, void AbslAnnotateThreadName(const char *, int,
const char *){} const char *){}
void AnnotateIgnoreReadsBegin(const char *, int){} void AbslAnnotateIgnoreReadsBegin(const char *, int){}
void AnnotateIgnoreReadsEnd(const char *, int){} void AbslAnnotateIgnoreReadsEnd(const char *, int){}
void AnnotateIgnoreWritesBegin(const char *, int){} void AbslAnnotateIgnoreWritesBegin(const char *, int){}
void AnnotateIgnoreWritesEnd(const char *, int){} void AbslAnnotateIgnoreWritesEnd(const char *, int){}
void AnnotateEnableRaceDetection(const char *, int, int){} void AbslAnnotateEnableRaceDetection(const char *, int, int){}
void AnnotateMemoryIsInitialized(const char *, int, void AbslAnnotateMemoryIsInitialized(const char *, int,
const volatile void *mem, size_t size) { const volatile void *mem, size_t size) {
#if __has_feature(memory_sanitizer) #if __has_feature(memory_sanitizer)
__msan_unpoison(mem, size); __msan_unpoison(mem, size);
...@@ -74,7 +74,7 @@ void AnnotateMemoryIsInitialized(const char *, int, ...@@ -74,7 +74,7 @@ void AnnotateMemoryIsInitialized(const char *, int,
#endif #endif
} }
void AnnotateMemoryIsUninitialized(const char *, int, void AbslAnnotateMemoryIsUninitialized(const char *, int,
const volatile void *mem, size_t size) { const volatile void *mem, size_t size) {
#if __has_feature(memory_sanitizer) #if __has_feature(memory_sanitizer)
__msan_allocated_memory(mem, size); __msan_allocated_memory(mem, size);
......
...@@ -81,26 +81,26 @@ ...@@ -81,26 +81,26 @@
point where "pointer" has been allocated, preferably close to the point point where "pointer" has been allocated, preferably close to the point
where the race happens. See also ANNOTATE_BENIGN_RACE_STATIC. */ where the race happens. See also ANNOTATE_BENIGN_RACE_STATIC. */
#define ANNOTATE_BENIGN_RACE(pointer, description) \ #define ANNOTATE_BENIGN_RACE(pointer, description) \
AnnotateBenignRaceSized(__FILE__, __LINE__, pointer, \ AbslAnnotateBenignRaceSized(__FILE__, __LINE__, pointer, \
sizeof(*(pointer)), description) sizeof(*(pointer)), description)
/* Same as ANNOTATE_BENIGN_RACE(address, description), but applies to /* Same as ANNOTATE_BENIGN_RACE(address, description), but applies to
the memory range [address, address+size). */ the memory range [address, address+size). */
#define ANNOTATE_BENIGN_RACE_SIZED(address, size, description) \ #define ANNOTATE_BENIGN_RACE_SIZED(address, size, description) \
AnnotateBenignRaceSized(__FILE__, __LINE__, address, size, description) AbslAnnotateBenignRaceSized(__FILE__, __LINE__, address, size, description)
/* Enable (enable!=0) or disable (enable==0) race detection for all threads. /* Enable (enable!=0) or disable (enable==0) race detection for all threads.
This annotation could be useful if you want to skip expensive race analysis This annotation could be useful if you want to skip expensive race analysis
during some period of program execution, e.g. during initialization. */ during some period of program execution, e.g. during initialization. */
#define ANNOTATE_ENABLE_RACE_DETECTION(enable) \ #define ANNOTATE_ENABLE_RACE_DETECTION(enable) \
AnnotateEnableRaceDetection(__FILE__, __LINE__, enable) AbslAnnotateEnableRaceDetection(__FILE__, __LINE__, enable)
/* ------------------------------------------------------------- /* -------------------------------------------------------------
Annotations useful for debugging. */ Annotations useful for debugging. */
/* Report the current thread name to a race detector. */ /* Report the current thread name to a race detector. */
#define ANNOTATE_THREAD_NAME(name) \ #define ANNOTATE_THREAD_NAME(name) \
AnnotateThreadName(__FILE__, __LINE__, name) AbslAnnotateThreadName(__FILE__, __LINE__, name)
/* ------------------------------------------------------------- /* -------------------------------------------------------------
Annotations useful when implementing locks. They are not Annotations useful when implementing locks. They are not
...@@ -109,29 +109,29 @@ ...@@ -109,29 +109,29 @@
/* Report that a lock has been created at address "lock". */ /* Report that a lock has been created at address "lock". */
#define ANNOTATE_RWLOCK_CREATE(lock) \ #define ANNOTATE_RWLOCK_CREATE(lock) \
AnnotateRWLockCreate(__FILE__, __LINE__, lock) AbslAnnotateRWLockCreate(__FILE__, __LINE__, lock)
/* Report that a linker initialized lock has been created at address "lock". /* Report that a linker initialized lock has been created at address "lock".
*/ */
#ifdef THREAD_SANITIZER #ifdef THREAD_SANITIZER
#define ANNOTATE_RWLOCK_CREATE_STATIC(lock) \ #define ANNOTATE_RWLOCK_CREATE_STATIC(lock) \
AnnotateRWLockCreateStatic(__FILE__, __LINE__, lock) AbslAnnotateRWLockCreateStatic(__FILE__, __LINE__, lock)
#else #else
#define ANNOTATE_RWLOCK_CREATE_STATIC(lock) ANNOTATE_RWLOCK_CREATE(lock) #define ANNOTATE_RWLOCK_CREATE_STATIC(lock) ANNOTATE_RWLOCK_CREATE(lock)
#endif #endif
/* Report that the lock at address "lock" is about to be destroyed. */ /* Report that the lock at address "lock" is about to be destroyed. */
#define ANNOTATE_RWLOCK_DESTROY(lock) \ #define ANNOTATE_RWLOCK_DESTROY(lock) \
AnnotateRWLockDestroy(__FILE__, __LINE__, lock) AbslAnnotateRWLockDestroy(__FILE__, __LINE__, lock)
/* Report that the lock at address "lock" has been acquired. /* Report that the lock at address "lock" has been acquired.
is_w=1 for writer lock, is_w=0 for reader lock. */ is_w=1 for writer lock, is_w=0 for reader lock. */
#define ANNOTATE_RWLOCK_ACQUIRED(lock, is_w) \ #define ANNOTATE_RWLOCK_ACQUIRED(lock, is_w) \
AnnotateRWLockAcquired(__FILE__, __LINE__, lock, is_w) AbslAnnotateRWLockAcquired(__FILE__, __LINE__, lock, is_w)
/* Report that the lock at address "lock" is about to be released. */ /* Report that the lock at address "lock" is about to be released. */
#define ANNOTATE_RWLOCK_RELEASED(lock, is_w) \ #define ANNOTATE_RWLOCK_RELEASED(lock, is_w) \
AnnotateRWLockReleased(__FILE__, __LINE__, lock, is_w) AbslAnnotateRWLockReleased(__FILE__, __LINE__, lock, is_w)
#else /* DYNAMIC_ANNOTATIONS_ENABLED == 0 */ #else /* DYNAMIC_ANNOTATIONS_ENABLED == 0 */
...@@ -150,10 +150,10 @@ ...@@ -150,10 +150,10 @@
/* These annotations are also made available to LLVM's Memory Sanitizer */ /* These annotations are also made available to LLVM's Memory Sanitizer */
#if DYNAMIC_ANNOTATIONS_ENABLED == 1 || defined(MEMORY_SANITIZER) #if DYNAMIC_ANNOTATIONS_ENABLED == 1 || defined(MEMORY_SANITIZER)
#define ANNOTATE_MEMORY_IS_INITIALIZED(address, size) \ #define ANNOTATE_MEMORY_IS_INITIALIZED(address, size) \
AnnotateMemoryIsInitialized(__FILE__, __LINE__, address, size) AbslAnnotateMemoryIsInitialized(__FILE__, __LINE__, address, size)
#define ANNOTATE_MEMORY_IS_UNINITIALIZED(address, size) \ #define ANNOTATE_MEMORY_IS_UNINITIALIZED(address, size) \
AnnotateMemoryIsUninitialized(__FILE__, __LINE__, address, size) AbslAnnotateMemoryIsUninitialized(__FILE__, __LINE__, address, size)
#else #else
#define ANNOTATE_MEMORY_IS_INITIALIZED(address, size) /* empty */ #define ANNOTATE_MEMORY_IS_INITIALIZED(address, size) /* empty */
#define ANNOTATE_MEMORY_IS_UNINITIALIZED(address, size) /* empty */ #define ANNOTATE_MEMORY_IS_UNINITIALIZED(address, size) /* empty */
...@@ -190,19 +190,19 @@ ...@@ -190,19 +190,19 @@
other reads and all writes. other reads and all writes.
See also ANNOTATE_UNPROTECTED_READ. */ See also ANNOTATE_UNPROTECTED_READ. */
#define ANNOTATE_IGNORE_READS_BEGIN() \ #define ANNOTATE_IGNORE_READS_BEGIN() \
AnnotateIgnoreReadsBegin(__FILE__, __LINE__) AbslAnnotateIgnoreReadsBegin(__FILE__, __LINE__)
/* Stop ignoring reads. */ /* Stop ignoring reads. */
#define ANNOTATE_IGNORE_READS_END() \ #define ANNOTATE_IGNORE_READS_END() \
AnnotateIgnoreReadsEnd(__FILE__, __LINE__) AbslAnnotateIgnoreReadsEnd(__FILE__, __LINE__)
/* Similar to ANNOTATE_IGNORE_READS_BEGIN, but ignore writes instead. */ /* Similar to ANNOTATE_IGNORE_READS_BEGIN, but ignore writes instead. */
#define ANNOTATE_IGNORE_WRITES_BEGIN() \ #define ANNOTATE_IGNORE_WRITES_BEGIN() \
AnnotateIgnoreWritesBegin(__FILE__, __LINE__) AbslAnnotateIgnoreWritesBegin(__FILE__, __LINE__)
/* Stop ignoring writes. */ /* Stop ignoring writes. */
#define ANNOTATE_IGNORE_WRITES_END() \ #define ANNOTATE_IGNORE_WRITES_END() \
AnnotateIgnoreWritesEnd(__FILE__, __LINE__) AbslAnnotateIgnoreWritesEnd(__FILE__, __LINE__)
/* Clang provides limited support for static thread-safety analysis /* Clang provides limited support for static thread-safety analysis
through a feature called Annotalysis. We configure macro-definitions through a feature called Annotalysis. We configure macro-definitions
...@@ -210,16 +210,16 @@ ...@@ -210,16 +210,16 @@
#elif defined(ANNOTALYSIS_ENABLED) #elif defined(ANNOTALYSIS_ENABLED)
#define ANNOTATE_IGNORE_READS_BEGIN() \ #define ANNOTATE_IGNORE_READS_BEGIN() \
StaticAnnotateIgnoreReadsBegin(__FILE__, __LINE__) StaticAbslAnnotateIgnoreReadsBegin(__FILE__, __LINE__)
#define ANNOTATE_IGNORE_READS_END() \ #define ANNOTATE_IGNORE_READS_END() \
StaticAnnotateIgnoreReadsEnd(__FILE__, __LINE__) StaticAbslAnnotateIgnoreReadsEnd(__FILE__, __LINE__)
#define ANNOTATE_IGNORE_WRITES_BEGIN() \ #define ANNOTATE_IGNORE_WRITES_BEGIN() \
StaticAnnotateIgnoreWritesBegin(__FILE__, __LINE__) StaticAbslAnnotateIgnoreWritesBegin(__FILE__, __LINE__)
#define ANNOTATE_IGNORE_WRITES_END() \ #define ANNOTATE_IGNORE_WRITES_END() \
StaticAnnotateIgnoreWritesEnd(__FILE__, __LINE__) StaticAbslAnnotateIgnoreWritesEnd(__FILE__, __LINE__)
#else #else
#define ANNOTATE_IGNORE_READS_BEGIN() /* empty */ #define ANNOTATE_IGNORE_READS_BEGIN() /* empty */
...@@ -256,41 +256,41 @@ ...@@ -256,41 +256,41 @@
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
void AnnotateRWLockCreate(const char *file, int line, void AbslAnnotateRWLockCreate(const char *file, int line,
const volatile void *lock); const volatile void *lock);
void AnnotateRWLockCreateStatic(const char *file, int line, void AbslAnnotateRWLockCreateStatic(const char *file, int line,
const volatile void *lock); const volatile void *lock);
void AnnotateRWLockDestroy(const char *file, int line, void AbslAnnotateRWLockDestroy(const char *file, int line,
const volatile void *lock); const volatile void *lock);
void AnnotateRWLockAcquired(const char *file, int line, void AbslAnnotateRWLockAcquired(const char *file, int line,
const volatile void *lock, long is_w); /* NOLINT */ const volatile void *lock, long is_w); /* NOLINT */
void AnnotateRWLockReleased(const char *file, int line, void AbslAnnotateRWLockReleased(const char *file, int line,
const volatile void *lock, long is_w); /* NOLINT */ const volatile void *lock, long is_w); /* NOLINT */
void AnnotateBenignRace(const char *file, int line, void AbslAnnotateBenignRace(const char *file, int line,
const volatile void *address, const volatile void *address,
const char *description); const char *description);
void AnnotateBenignRaceSized(const char *file, int line, void AbslAnnotateBenignRaceSized(const char *file, int line,
const volatile void *address, const volatile void *address,
size_t size, size_t size,
const char *description); const char *description);
void AnnotateThreadName(const char *file, int line, void AbslAnnotateThreadName(const char *file, int line,
const char *name); const char *name);
void AnnotateEnableRaceDetection(const char *file, int line, int enable); void AbslAnnotateEnableRaceDetection(const char *file, int line, int enable);
void AnnotateMemoryIsInitialized(const char *file, int line, void AbslAnnotateMemoryIsInitialized(const char *file, int line,
const volatile void *mem, size_t size); const volatile void *mem, size_t size);
void AnnotateMemoryIsUninitialized(const char *file, int line, void AbslAnnotateMemoryIsUninitialized(const char *file, int line,
const volatile void *mem, size_t size); const volatile void *mem, size_t size);
/* Annotations expand to these functions, when Dynamic Annotations are enabled. /* Annotations expand to these functions, when Dynamic Annotations are enabled.
These functions are either implemented as no-op calls, if no Sanitizer is These functions are either implemented as no-op calls, if no Sanitizer is
attached, or provided with externally-linked implementations by a library attached, or provided with externally-linked implementations by a library
like ThreadSanitizer. */ like ThreadSanitizer. */
void AnnotateIgnoreReadsBegin(const char *file, int line) void AbslAnnotateIgnoreReadsBegin(const char *file, int line)
ATTRIBUTE_IGNORE_READS_BEGIN; ATTRIBUTE_IGNORE_READS_BEGIN;
void AnnotateIgnoreReadsEnd(const char *file, int line) void AbslAnnotateIgnoreReadsEnd(const char *file, int line)
ATTRIBUTE_IGNORE_READS_END; ATTRIBUTE_IGNORE_READS_END;
void AnnotateIgnoreWritesBegin(const char *file, int line); void AbslAnnotateIgnoreWritesBegin(const char *file, int line);
void AnnotateIgnoreWritesEnd(const char *file, int line); void AbslAnnotateIgnoreWritesEnd(const char *file, int line);
#if defined(ANNOTALYSIS_ENABLED) #if defined(ANNOTALYSIS_ENABLED)
/* When Annotalysis is enabled without Dynamic Annotations, the use of /* When Annotalysis is enabled without Dynamic Annotations, the use of
...@@ -301,13 +301,13 @@ void AnnotateIgnoreWritesEnd(const char *file, int line); ...@@ -301,13 +301,13 @@ void AnnotateIgnoreWritesEnd(const char *file, int line);
allows IGNORE_READS_AND_WRITES to work properly. */ allows IGNORE_READS_AND_WRITES to work properly. */
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function" #pragma GCC diagnostic ignored "-Wunused-function"
static inline void StaticAnnotateIgnoreReadsBegin(const char *file, int line) static inline void StaticAbslAnnotateIgnoreReadsBegin(const char *file, int line)
ATTRIBUTE_IGNORE_READS_BEGIN { (void)file; (void)line; } ATTRIBUTE_IGNORE_READS_BEGIN { (void)file; (void)line; }
static inline void StaticAnnotateIgnoreReadsEnd(const char *file, int line) static inline void StaticAbslAnnotateIgnoreReadsEnd(const char *file, int line)
ATTRIBUTE_IGNORE_READS_END { (void)file; (void)line; } ATTRIBUTE_IGNORE_READS_END { (void)file; (void)line; }
static inline void StaticAnnotateIgnoreWritesBegin( static inline void StaticAbslAnnotateIgnoreWritesBegin(
const char *file, int line) { (void)file; (void)line; } const char *file, int line) { (void)file; (void)line; }
static inline void StaticAnnotateIgnoreWritesEnd( static inline void StaticAbslAnnotateIgnoreWritesEnd(
const char *file, int line) { (void)file; (void)line; } const char *file, int line) { (void)file; (void)line; }
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment