summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorBrian Gaeke <gaeke@uiuc.edu>2003-06-16 21:54:01 +0000
committerBrian Gaeke <gaeke@uiuc.edu>2003-06-16 21:54:01 +0000
commitad95d9ef50cbd789025dbff8a1e018650cbcdc7f (patch)
treeb65b2fdf28df6eacbe0e7d54e3a0a81237f3e24b /include
parent5c91898e57336d8457bddce63e4d7ba7fedc936e (diff)
downloadllvm-ad95d9ef50cbd789025dbff8a1e018650cbcdc7f.tar.gz
llvm-ad95d9ef50cbd789025dbff8a1e018650cbcdc7f.tar.bz2
llvm-ad95d9ef50cbd789025dbff8a1e018650cbcdc7f.tar.xz
Isolate machine-dependent use of <alloca.h> in "Support/Alloca.h",
so that we can easily change its use to be conditional on the result of an autoconf test later. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6723 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/Support/Alloca.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/include/Support/Alloca.h b/include/Support/Alloca.h
new file mode 100644
index 0000000000..3c163ed0d6
--- /dev/null
+++ b/include/Support/Alloca.h
@@ -0,0 +1,30 @@
+//===-- include/Support/Alloca.h - Support for alloca header -----*- C++ -*--=//
+//
+// Some platforms do not have alloca.h; others do. You can include this
+// file instead of <alloca.h> and it will include <alloca.h> on the platforms
+// that require you to do so to use alloca().
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_SUPPORT_ALLOCA_H
+#define LLVM_SUPPORT_ALLOCA_H
+
+// TODO: Determine HAVE_ALLOCA_H based on autoconf results.
+// The following method is too brittle.
+#if defined(HAVE_ALLOCA_H)
+#undef HAVE_ALLOCA_H
+#endif
+
+#if defined(__linux__)
+#define HAVE_ALLOCA_H 1
+#elif defined(__sparc__)
+#define HAVE_ALLOCA_H 1
+#elif defined(__FreeBSD__)
+// not defined here
+#endif
+
+#if HAVE_ALLOCA_H
+#include <alloca.h>
+#endif
+
+#endif /* LLVM_SUPPORT_ALLOCA_H */