summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/sanitizer_common/tests/sanitizer_test_utils.h
diff options
context:
space:
mode:
authorTimur Iskhodzhanov <timurrrr@google.com>2014-05-08 12:43:33 +0000
committerTimur Iskhodzhanov <timurrrr@google.com>2014-05-08 12:43:33 +0000
commit76f43eecb014dab210fb089a3b25ee140ecf6142 (patch)
tree027d3200ce6fd41c892f3caaaec84051a1a39e36 /compiler-rt/lib/sanitizer_common/tests/sanitizer_test_utils.h
parentd39320c6b69b6fcc453ab2a6ff108fd58ab20f16 (diff)
downloadbcm5719-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
Diffstat (limited to 'compiler-rt/lib/sanitizer_common/tests/sanitizer_test_utils.h')
-rw-r--r--compiler-rt/lib/sanitizer_common/tests/sanitizer_test_utils.h17
1 files changed, 6 insertions, 11 deletions
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
OpenPOWER on IntegriCloud