output foo(void) as appropriate
authorChris Lattner <sabre@nondot.org>
Wed, 26 Nov 2003 00:09:17 +0000 (00:09 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 26 Nov 2003 00:09:17 +0000 (00:09 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10232 91177308-0d34-0410-b5e6-96231b3b80d8

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

index b3b5b40e242ba07e1e6ed105bcfeddee2b154308..eeb2bdd4f3b5d727070ee023953c702d1b45e067 100644 (file)
@@ -941,6 +941,8 @@ void CWriter::printFunctionSignature(const Function *F, bool Prototype) {
   if (FT->isVarArg() && !FT->getParamTypes().empty()) {
     if (FT->getParamTypes().size()) FunctionInnards << ", ";
     FunctionInnards << "...";  // Output varargs portion of signature!
+  } else if (!FT->isVarArg() && FT->getParamTypes().empty()) {
+    FunctionInnards << "void"; // ret() -> ret(void) in C.
   }
   FunctionInnards << ")";
   // Print out the return type and the entire signature for that matter
index b3b5b40e242ba07e1e6ed105bcfeddee2b154308..eeb2bdd4f3b5d727070ee023953c702d1b45e067 100644 (file)
@@ -941,6 +941,8 @@ void CWriter::printFunctionSignature(const Function *F, bool Prototype) {
   if (FT->isVarArg() && !FT->getParamTypes().empty()) {
     if (FT->getParamTypes().size()) FunctionInnards << ", ";
     FunctionInnards << "...";  // Output varargs portion of signature!
+  } else if (!FT->isVarArg() && FT->getParamTypes().empty()) {
+    FunctionInnards << "void"; // ret() -> ret(void) in C.
   }
   FunctionInnards << ")";
   // Print out the return type and the entire signature for that matter