forked from OSchip/llvm-project
[Sanitizer] Workaround for -Wunused-private-field warning - add an attribute in TSan unit test, and silence this warning as gtest has unused fields.
llvm-svn: 158449
This commit is contained in:
parent
52f946611f
commit
aac5d0c831
|
@ -47,6 +47,7 @@ typedef unsigned long DWORD; // NOLINT
|
|||
# define ALWAYS_INLINE __attribute__((always_inline))
|
||||
# define LIKELY(x) __builtin_expect(!!(x), 1)
|
||||
# define UNLIKELY(x) __builtin_expect(!!(x), 0)
|
||||
# define UNUSED __attribute__((unused))
|
||||
# define USED __attribute__((used))
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
DEBUG=0
|
||||
LDFLAGS=-ldl -lpthread -pie
|
||||
CXXFLAGS = -fPIE -g -Wall -Werror -DTSAN_DEBUG=$(DEBUG)
|
||||
CXXFLAGS = -fPIE -g -Wall -Werror -DTSAN_DEBUG=$(DEBUG)
|
||||
# Gtest has unused private field. GCC doesn't know -Wunused-private-field warning
|
||||
CXXFLAGS += -Wno-unused-private-field -Wno-attributes
|
||||
ifeq ($(DEBUG), 0)
|
||||
CXXFLAGS += -O3
|
||||
endif
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
// This file is a part of ThreadSanitizer (TSan), a race detector.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
#include "sanitizer_common/sanitizer_internal_defs.h"
|
||||
#include "tsan_atomic.h"
|
||||
#include "tsan_mutex.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
@ -45,7 +46,7 @@ class TestData {
|
|||
static const int kSize = 64;
|
||||
typedef u64 T;
|
||||
Mutex mtx_;
|
||||
char pad_[kCacheLineSize];
|
||||
char pad_[kCacheLineSize] UNUSED;
|
||||
T data_[kSize];
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue