From db846ea8a65402c53ee4ed566613e98cbca7d21b Mon Sep 17 00:00:00 2001 From: Timur Iskhodzhanov Date: Thu, 8 May 2014 12:43:33 +0000 Subject: [PATCH] [ASan] Update sanitizer_common and asan test_util headers to support building on Windows git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@208306 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/asan/tests/asan_test_utils.h | 9 ++++++--- lib/sanitizer_common/tests/sanitizer_test_utils.h | 17 ++++++----------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/lib/asan/tests/asan_test_utils.h b/lib/asan/tests/asan_test_utils.h index a536f3137..e9f367a2e 100644 --- a/lib/asan/tests/asan_test_utils.h +++ b/lib/asan/tests/asan_test_utils.h @@ -25,13 +25,16 @@ #include #include #include -#include -#include #include -#include #include #include + +#if !defined(_WIN32) +#include +#include #include +#include +#endif #ifdef __linux__ # include diff --git a/lib/sanitizer_common/tests/sanitizer_test_utils.h b/lib/sanitizer_common/tests/sanitizer_test_utils.h index 3ec085d6b..dabd61f1d 100644 --- a/lib/sanitizer_common/tests/sanitizer_test_utils.h +++ b/lib/sanitizer_common/tests/sanitizer_test_utils.h @@ -15,21 +15,14 @@ #ifndef SANITIZER_TEST_UTILS_H #define SANITIZER_TEST_UTILS_H +#include + #if defined(_WIN32) -typedef unsigned __int8 uint8_t; -typedef unsigned __int16 uint16_t; -typedef unsigned __int32 uint32_t; -typedef unsigned __int64 uint64_t; -typedef __int8 int8_t; -typedef __int16 int16_t; -typedef __int32 int32_t; -typedef __int64 int64_t; # define NOINLINE __declspec(noinline) # define USED #else // defined(_WIN32) # define NOINLINE __attribute__((noinline)) # define USED __attribute__((used)) -#include #endif // defined(_WIN32) #if !defined(__has_feature) @@ -53,7 +46,9 @@ typedef __int64 int64_t; // Make the compiler thinks that something is going on there. inline void break_optimization(void *arg) { +#if !defined(_WIN32) || defined(__clang__) __asm__ __volatile__("" : : "r" (arg) : "memory"); +#endif } // This function returns its parameter but in such a way that compiler @@ -80,13 +75,13 @@ static inline uint32_t my_rand() { // Set availability of platform-specific functions. -#if !defined(__APPLE__) && !defined(ANDROID) && !defined(__ANDROID__) +#if !defined(__APPLE__) && !defined(ANDROID) && !defined(__ANDROID__) && !defined(_WIN32) # define SANITIZER_TEST_HAS_POSIX_MEMALIGN 1 #else # define SANITIZER_TEST_HAS_POSIX_MEMALIGN 0 #endif -#if !defined(__APPLE__) && !defined(__FreeBSD__) +#if !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(_WIN32) # define SANITIZER_TEST_HAS_MEMALIGN 1 # define SANITIZER_TEST_HAS_PVALLOC 1 # define SANITIZER_TEST_HAS_MALLOC_USABLE_SIZE 1 -- 2.11.4.GIT