summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorArseny Kapoulkine <arseny.kapoulkine@gmail.com>2015-05-12 21:49:44 -0700
committerArseny Kapoulkine <arseny.kapoulkine@gmail.com>2015-05-12 21:49:44 -0700
commit01f627a4d75ae25850bc29df74112696da571326 (patch)
treeb2067323f7d1b68fae1cf7e7ed15b8bdc6a071ce /tests
parent107239c9275c2f410e5635555805a4c982b5469b (diff)
tests: Fix address sanitizer detection for GCC
Diffstat (limited to 'tests')
-rw-r--r--tests/allocator.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/tests/allocator.cpp b/tests/allocator.cpp
index a2bcb48..e5c634c 100644
--- a/tests/allocator.cpp
+++ b/tests/allocator.cpp
@@ -4,6 +4,13 @@
#include <assert.h>
#include <stdlib.h>
+// Address sanitizer
+#if defined(__has_feature)
+# define ADDRESS_SANITIZER __has_feature(address_sanitizer)
+#else
+# define ADDRESS_SANITIZER defined(__SANITIZE_ADDRESS__)
+#endif
+
// Low-level allocation functions
#if defined(_WIN32) || defined(_WIN64)
# ifdef __MWERKS__
@@ -67,7 +74,7 @@ namespace
VirtualProtect(rptr, aligned_size + page_size, PAGE_NOACCESS, &old_flags);
}
}
-#elif (defined(__APPLE__) || defined(__linux__)) && !((defined(__has_feature) && __has_feature(address_sanitizer)) || defined(__SANITIZE_ADDRESS__))
+#elif (defined(__APPLE__) || defined(__linux__)) && !ADDRESS_SANITIZER
# include <sys/mman.h>
namespace