diff options
author | Timur Iskhodzhanov <timurrrr@google.com> | 2014-05-08 12:43:33 +0000 |
---|---|---|
committer | Timur Iskhodzhanov <timurrrr@google.com> | 2014-05-08 12:43:33 +0000 |
commit | 76f43eecb014dab210fb089a3b25ee140ecf6142 (patch) | |
tree | 027d3200ce6fd41c892f3caaaec84051a1a39e36 | |
parent | d39320c6b69b6fcc453ab2a6ff108fd58ab20f16 (diff) | |
download | bcm5719-llvm-76f43eecb014dab210fb089a3b25ee140ecf6142.tar.gz bcm5719-llvm-76f43eecb014dab210fb089a3b25ee140ecf6142.zip |
[ASan] Update sanitizer_common and asan test_util headers to support building on Windows
llvm-svn: 208306
-rw-r--r-- | compiler-rt/lib/asan/tests/asan_test_utils.h | 9 | ||||
-rw-r--r-- | compiler-rt/lib/sanitizer_common/tests/sanitizer_test_utils.h | 17 |
2 files changed, 12 insertions, 14 deletions
diff --git a/compiler-rt/lib/asan/tests/asan_test_utils.h b/compiler-rt/lib/asan/tests/asan_test_utils.h index a536f3137d0..e9f367a2e10 100644 --- a/compiler-rt/lib/asan/tests/asan_test_utils.h +++ b/compiler-rt/lib/asan/tests/asan_test_utils.h @@ -25,13 +25,16 @@ #include <signal.h> #include <stdlib.h> #include <string.h> -#include <strings.h> -#include <pthread.h> #include <stdint.h> -#include <setjmp.h> #include <assert.h> #include <algorithm> + +#if !defined(_WIN32) +#include <strings.h> +#include <pthread.h> #include <sys/mman.h> +#include <setjmp.h> +#endif #ifdef __linux__ # include <sys/prctl.h> diff --git a/compiler-rt/lib/sanitizer_common/tests/sanitizer_test_utils.h b/compiler-rt/lib/sanitizer_common/tests/sanitizer_test_utils.h index 3ec085d6b42..dabd61f1ddb 100644 --- a/compiler-rt/lib/sanitizer_common/tests/sanitizer_test_utils.h +++ b/compiler-rt/lib/sanitizer_common/tests/sanitizer_test_utils.h @@ -15,21 +15,14 @@ #ifndef SANITIZER_TEST_UTILS_H #define SANITIZER_TEST_UTILS_H +#include <stdint.h> + #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 <stdint.h> #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 |