[PATCH] D21864: [compiler-rt] Fix broken unittest using alloca on MSVC.

Etienne Bergeron via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 29 15:15:28 PDT 2016


etienneb created this revision.
etienneb added a reviewer: rnk.
etienneb added subscribers: kubabrecka, chrisha, wang0109, llvm-commits.

The alloca header is not present on windows.

This test was committed recently:
  http://reviews.llvm.org/D21509
  http://reviews.llvm.org/rL273889

http://reviews.llvm.org/D21864

Files:
  test/asan/TestCases/alloca_constant_size.cc

Index: test/asan/TestCases/alloca_constant_size.cc
===================================================================
--- test/asan/TestCases/alloca_constant_size.cc
+++ test/asan/TestCases/alloca_constant_size.cc
@@ -4,10 +4,17 @@
 // RUN: %run %t 1 2>&1 | FileCheck %s
 // RUN: %run %t 2 2>&1 | FileCheck %s
 
-#include <alloca.h>
 #include <stdio.h>
 #include <string.h>
 
+// MSVC provides _alloca instead of alloca.
+#if defined(_MSC_VER) && !defined(alloca)
+# define alloca _alloca
+#else
+#include <alloca.h>
+#endif
+
+
 void f1_alloca() {
   char *dynamic_buffer = (char *)alloca(200);
   fprintf(stderr, "dynamic_buffer = %p\n", dynamic_buffer);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D21864.62292.patch
Type: text/x-patch
Size: 658 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160629/7737ab77/attachment.bin>


More information about the llvm-commits mailing list