[llvm-commits] [compiler-rt] r158449 - in /compiler-rt/trunk/lib: sanitizer_common/sanitizer_internal_defs.h tsan/Makefile.old tsan/unit_tests/tsan_mutex_test.cc

Alexey Samsonov samsonov at google.com
Thu Jun 14 07:02:32 PDT 2012


Author: samsonov
Date: Thu Jun 14 09:02:32 2012
New Revision: 158449

URL: http://llvm.org/viewvc/llvm-project?rev=158449&view=rev
Log:
[Sanitizer] Workaround for -Wunused-private-field warning - add an attribute in TSan unit test, and silence this warning as gtest has unused fields.

Modified:
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_internal_defs.h
    compiler-rt/trunk/lib/tsan/Makefile.old
    compiler-rt/trunk/lib/tsan/unit_tests/tsan_mutex_test.cc

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_internal_defs.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_internal_defs.h?rev=158449&r1=158448&r2=158449&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_internal_defs.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_internal_defs.h Thu Jun 14 09:02:32 2012
@@ -47,6 +47,7 @@
 # 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
 

Modified: compiler-rt/trunk/lib/tsan/Makefile.old
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/Makefile.old?rev=158449&r1=158448&r2=158449&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/Makefile.old (original)
+++ compiler-rt/trunk/lib/tsan/Makefile.old Thu Jun 14 09:02:32 2012
@@ -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

Modified: compiler-rt/trunk/lib/tsan/unit_tests/tsan_mutex_test.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/unit_tests/tsan_mutex_test.cc?rev=158449&r1=158448&r2=158449&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/unit_tests/tsan_mutex_test.cc (original)
+++ compiler-rt/trunk/lib/tsan/unit_tests/tsan_mutex_test.cc Thu Jun 14 09:02:32 2012
@@ -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 @@
   static const int kSize = 64;
   typedef u64 T;
   Mutex mtx_;
-  char pad_[kCacheLineSize];
+  char pad_[kCacheLineSize] UNUSED;
   T data_[kSize];
 };
 





More information about the llvm-commits mailing list