From 3ac1d4dc1042075915acf1bf98778420f13659c7 Mon Sep 17 00:00:00 2001 From: Vedant Kumar Date: Wed, 23 Nov 2016 22:23:42 +0000 Subject: [PATCH] [test] Use a helper macro to refer to MAP_ANON (NFC) Some of our internal bots use old SDK's which don't define MAP_ANON. Use a helper macro to pass the right flag into mmap(). llvm-svn: 287833 --- compiler-rt/test/tsan/ignore_lib5.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/compiler-rt/test/tsan/ignore_lib5.cc b/compiler-rt/test/tsan/ignore_lib5.cc index 330f110..d7cd285 100644 --- a/compiler-rt/test/tsan/ignore_lib5.cc +++ b/compiler-rt/test/tsan/ignore_lib5.cc @@ -27,14 +27,20 @@ # define MAP_32BIT 0 #endif +#ifdef __APPLE__ +# define TSAN_MAP_ANON MAP_ANON +#else +# define TSAN_MAP_ANON MAP_ANONYMOUS +#endif + void *thr(void *arg) { // This thread creates lots of separate mappings in /proc/self/maps before // the ignored library. for (int i = 0; i < 10000; i++) { if (i == 5000) barrier_wait(&barrier); - mmap(0, 4096, PROT_READ, MAP_ANONYMOUS | MAP_PRIVATE | MAP_32BIT, -1 , 0); - mmap(0, 4096, PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE | MAP_32BIT, -1 , 0); + mmap(0, 4096, PROT_READ, TSAN_MAP_ANON | MAP_PRIVATE | MAP_32BIT, -1 , 0); + mmap(0, 4096, PROT_WRITE, TSAN_MAP_ANON | MAP_PRIVATE | MAP_32BIT, -1 , 0); } return 0; } -- 2.7.4