[compiler-rt] r274230 - [compiler-rt] Fix broken unittest using alloca on MSVC.

Etienne Bergeron via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 30 07:37:02 PDT 2016


Author: etienneb
Date: Thu Jun 30 09:37:02 2016
New Revision: 274230

URL: http://llvm.org/viewvc/llvm-project?rev=274230&view=rev
Log:
[compiler-rt] Fix broken unittest using alloca on MSVC.

Summary:
The alloca header is not present on windows.

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

Reviewers: rnk

Subscribers: llvm-commits, wang0109, chrisha, kubabrecka

Differential Revision: http://reviews.llvm.org/D21864

Modified:
    compiler-rt/trunk/test/asan/TestCases/alloca_constant_size.cc

Modified: compiler-rt/trunk/test/asan/TestCases/alloca_constant_size.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/asan/TestCases/alloca_constant_size.cc?rev=274230&r1=274229&r2=274230&view=diff
==============================================================================
--- compiler-rt/trunk/test/asan/TestCases/alloca_constant_size.cc (original)
+++ compiler-rt/trunk/test/asan/TestCases/alloca_constant_size.cc Thu Jun 30 09:37:02 2016
@@ -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);




More information about the llvm-commits mailing list