[ASan tests] Use the proper attribute on RunStrChrTest helper functions to avoid "unused function" warnings

llvm-svn: 208568
This commit is contained in:
Timur Iskhodzhanov 2014-05-12 14:31:57 +00:00
parent 4066e8dd64
commit 9a205ed8ee
2 changed files with 11 additions and 5 deletions

View File

@ -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(PointerToStrChr1 StrChr) {
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';

View File

@ -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