[compiler-rt] r208568 - [ASan tests] Use the proper attribute on RunStrChrTest helper functions to avoid "unused function" warnings
Timur Iskhodzhanov
timurrrr at google.com
Mon May 12 07:31:57 PDT 2014
Author: timurrrr
Date: Mon May 12 09:31:57 2014
New Revision: 208568
URL: http://llvm.org/viewvc/llvm-project?rev=208568&view=rev
Log:
[ASan tests] Use the proper attribute on RunStrChrTest helper functions to avoid "unused function" warnings
Modified:
compiler-rt/trunk/lib/asan/tests/asan_str_test.cc
compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_test_utils.h
Modified: compiler-rt/trunk/lib/asan/tests/asan_str_test.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/tests/asan_str_test.cc?rev=208568&r1=208567&r2=208568&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/tests/asan_str_test.cc (original)
+++ compiler-rt/trunk/lib/asan/tests/asan_str_test.cc Mon May 12 09:31:57 2014
@@ -186,7 +186,7 @@ TEST(AddressSanitizer, StrNCpyOOBTest) {
typedef char*(*PointerToStrChr1)(const char*, int);
typedef char*(*PointerToStrChr2)(char*, int);
-USED static void RunStrChrTest(PointerToStrChr1 StrChr) {
+UNUSED static void RunStrChrTest(PointerToStrChr1 StrChr) {
size_t size = Ident(100);
char *str = MallocAndMemsetString(size);
str[10] = 'q';
@@ -202,7 +202,7 @@ USED static void RunStrChrTest(PointerTo
EXPECT_DEATH(Ident(StrChr(str, 'a')), RightOOBReadMessage(0));
free(str);
}
-USED static void RunStrChrTest(PointerToStrChr2 StrChr) {
+UNUSED static void RunStrChrTest(PointerToStrChr2 StrChr) {
size_t size = Ident(100);
char *str = MallocAndMemsetString(size);
str[10] = 'q';
Modified: compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_test_utils.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_test_utils.h?rev=208568&r1=208567&r2=208568&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_test_utils.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/tests/sanitizer_test_utils.h Mon May 12 09:31:57 2014
@@ -17,14 +17,20 @@
#include <stdint.h>
-#if defined(_WIN32)
+#if defined(_MSC_VER)
# define NOINLINE __declspec(noinline)
-# define USED
#else // defined(_WIN32)
# define NOINLINE __attribute__((noinline))
-# define USED __attribute__((used))
#endif // defined(_WIN32)
+#if !defined(_MSC_VER) || defined(__clang__)
+# define UNUSED __attribute__((unused))
+# define USED __attribute__((used))
+#else
+# define UNUSED
+# define USED
+#endif
+
#if !defined(__has_feature)
#define __has_feature(x) 0
#endif
More information about the llvm-commits
mailing list