Detect TSAN instead of relying on #ifdef THREAD_SANITIZER.

And reindent.

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2293063002

CQ_INCLUDE_TRYBOTS=master.client.skia:Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-TSAN-Trybot

Review-Url: https://codereview.chromium.org/2293063002
This commit is contained in:
mtklein 2016-08-30 10:45:17 -07:00 committed by Commit bot
parent fce1906472
commit e6ec16356e
2 changed files with 51 additions and 50 deletions

View File

@ -464,9 +464,6 @@
],
'ldflags': [ '-fsanitize=<(skia_sanitizer)' ],
'conditions' : [
[ 'skia_sanitizer == "thread"', {
'defines': [ 'THREAD_SANITIZER' ],
}],
[ 'skia_sanitizer == "memory"', {
'cflags': [
'-O1',

View File

@ -11,7 +11,11 @@
#include "SkTypes.h"
#include "SkSemaphore.h"
#if defined(THREAD_SANITIZER)
#if !defined(__has_feature)
#define __has_feature(x) 0
#endif
#if __has_feature(thread_sanitizer)
/* Report that a lock has been created at address "lock". */
#define ANNOTATE_RWLOCK_CREATE(lock) \
@ -30,8 +34,8 @@
#define ANNOTATE_RWLOCK_RELEASED(lock, is_w) \
AnnotateRWLockReleased(__FILE__, __LINE__, lock, is_w)
#ifdef DYNAMIC_ANNOTATIONS_WANT_ATTRIBUTE_WEAK
# ifdef __GNUC__
#if defined(DYNAMIC_ANNOTATIONS_WANT_ATTRIBUTE_WEAK)
#if defined(__GNUC__)
#define DYNAMIC_ANNOTATIONS_ATTRIBUTE_WEAK __attribute__((weak))
#else
/* TODO(glider): for Windows support we may want to change this macro in order