Really fix FreeBSD, which apparently doesn't tolerate the extern.
authorChris Lattner <sabre@nondot.org>
Wed, 6 Oct 2004 04:21:52 +0000 (04:21 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 6 Oct 2004 04:21:52 +0000 (04:21 +0000)
Thanks to Jeff Cohen for pointing out my goof.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16762 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/CBackend/CBackend.cpp
lib/Target/CBackend/Writer.cpp

index 85229ad50c67c7443de2358acf0b52a01934aae5..bdc8b8d650031c4891c292ee3f971b43a8323073 100644 (file)
@@ -702,10 +702,11 @@ void CWriter::writeOperand(Value *Operand) {
 static void generateCompilerSpecificCode(std::ostream& Out) {
   // Alloca is hard to get, and we don't want to include stdlib.h here...
   Out << "/* get a declaration for alloca */\n"
-      << "#if defined(sun) || defined(__CYGWIN__) || defined(__APPLE__) || "
-      << "defined(__FreeBSD__)\n"
+      << "#if defined(sun) || defined(__CYGWIN__) || defined(__APPLE__)\n"
       << "extern void *__builtin_alloca(unsigned long);\n"
       << "#define alloca(x) __builtin_alloca(x)\n"
+      << "#elif defined(__FreeBSD__)\n"
+      << "#define alloca(x) __builtin_alloca(x)\n"
       << "#else\n"
       << "#include <alloca.h>\n"
       << "#endif\n\n";
index 85229ad50c67c7443de2358acf0b52a01934aae5..bdc8b8d650031c4891c292ee3f971b43a8323073 100644 (file)
@@ -702,10 +702,11 @@ void CWriter::writeOperand(Value *Operand) {
 static void generateCompilerSpecificCode(std::ostream& Out) {
   // Alloca is hard to get, and we don't want to include stdlib.h here...
   Out << "/* get a declaration for alloca */\n"
-      << "#if defined(sun) || defined(__CYGWIN__) || defined(__APPLE__) || "
-      << "defined(__FreeBSD__)\n"
+      << "#if defined(sun) || defined(__CYGWIN__) || defined(__APPLE__)\n"
       << "extern void *__builtin_alloca(unsigned long);\n"
       << "#define alloca(x) __builtin_alloca(x)\n"
+      << "#elif defined(__FreeBSD__)\n"
+      << "#define alloca(x) __builtin_alloca(x)\n"
       << "#else\n"
       << "#include <alloca.h>\n"
       << "#endif\n\n";