[PATCH] Add FreeBSD support for asan_test.cc

Viktor Kutuzov vkutuzov at accesssoftek.com
Thu Mar 6 04:42:22 PST 2014


Hi kcc, samsonov,

http://llvm-reviews.chandlerc.com/D2983

Files:
  lib/asan/tests/asan_test.cc

Index: lib/asan/tests/asan_test.cc
===================================================================
--- lib/asan/tests/asan_test.cc
+++ lib/asan/tests/asan_test.cc
@@ -25,7 +25,7 @@
 NOINLINE void *malloc_aaa(size_t size) {
   void *res = malloc_bbb(size); break_optimization(0); return res;}
 
-#ifndef __APPLE__
+#if !defined(__APPLE__) && !defined(__FreeBSD__)
 NOINLINE void *memalign_fff(size_t alignment, size_t size) {
   void *res = memalign/**/(alignment, size); break_optimization(0); return res;}
 NOINLINE void *memalign_eee(size_t alignment, size_t size) {
@@ -38,7 +38,7 @@
   void *res = memalign_ccc(alignment, size); break_optimization(0); return res;}
 NOINLINE void *memalign_aaa(size_t alignment, size_t size) {
   void *res = memalign_bbb(alignment, size); break_optimization(0); return res;}
-#endif  // __APPLE__
+#endif  // !defined(__APPLE__) && !defined(__FreeBSD__)
 
 
 NOINLINE void free_ccc(void *p) { free(p); break_optimization(0);}
@@ -97,12 +97,12 @@
   free(pm);
 #endif
 
-#if !defined(__APPLE__)
+#if !defined(__APPLE__) && !defined(__FreeBSD__)
   int *ma = (int*)memalign(kPageSize, kPageSize);
   EXPECT_EQ(0U, (uintptr_t)ma % kPageSize);
   ma[123] = 0;
   free(ma);
-#endif  // __APPLE__
+#endif  // !defined(__APPLE__) && !defined(__FreeBSD__)
 }
 
 TEST(AddressSanitizer, CallocTest) {
@@ -135,7 +135,7 @@
   free(a);
 }
 
-#ifndef __APPLE__
+#if !defined(__APPLE__) && !defined(__FreeBSD__)
 TEST(AddressSanitizer, PvallocTest) {
   char *a = (char*)pvalloc(kPageSize + 100);
   EXPECT_EQ(0U, (uintptr_t)a % kPageSize);
@@ -147,7 +147,7 @@
   a[101] = 1;  // we should not report an error here.
   free(a);
 }
-#endif  // __APPLE__
+#endif  // !defined(__APPLE__) && !defined(__FreeBSD__)
 
 void *TSDWorker(void *test_key) {
   if (test_key) {
@@ -306,7 +306,7 @@
                "AddressSanitizer failed to allocate");
 }
 
-#ifndef __APPLE__
+#if !defined(__APPLE__) && !defined(__FreeBSD__)
 void MemalignRun(size_t align, size_t size, int idx) {
   char *p = (char *)memalign(align, size);
   Ident(p)[idx] = 0;
@@ -322,7 +322,7 @@
                  "is located 1 bytes to the right");
   }
 }
-#endif
+#endif  // !defined(__APPLE__) && !defined(__FreeBSD__)
 
 void *ManyThreadsWorker(void *a) {
   for (int iter = 0; iter < 100; iter++) {
@@ -396,7 +396,7 @@
   delete[] int_ptr2;
 }
 
-#ifndef __APPLE__
+#if !defined(__APPLE__) && !defined(__FreeBSD__)
 static const char *kMallocUsableSizeErrorMsg =
   "AddressSanitizer: attempting to call malloc_usable_size()";
 
@@ -414,7 +414,7 @@
   EXPECT_DEATH(malloc_usable_size(array), kMallocUsableSizeErrorMsg);
   delete int_ptr;
 }
-#endif
+#endif  // !defined(__APPLE__) && !defined(__FreeBSD__)
 
 void WrongFree() {
   int *x = (int*)malloc(100 * sizeof(int));
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D2983.1.patch
Type: text/x-patch
Size: 2769 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140306/1c1d03e9/attachment.bin>


More information about the llvm-commits mailing list