aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target/CBackend
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-11-26 00:09:17 +0000
committerChris Lattner <sabre@nondot.org>2003-11-26 00:09:17 +0000
commit4f7e173cbd711bd8fed827ab7ecffb9e898a0d99 (patch)
tree2e821037b6202b8bef0d9e919193f7db387c47e6 /lib/Target/CBackend
parentbc771c5608c077a3978e8cb36e136b31dcc53430 (diff)
downloadexternal_llvm-4f7e173cbd711bd8fed827ab7ecffb9e898a0d99.zip
external_llvm-4f7e173cbd711bd8fed827ab7ecffb9e898a0d99.tar.gz
external_llvm-4f7e173cbd711bd8fed827ab7ecffb9e898a0d99.tar.bz2
output foo(void) as appropriate
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10232 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/CBackend')
-rw-r--r--lib/Target/CBackend/CBackend.cpp2
-rw-r--r--lib/Target/CBackend/Writer.cpp2
2 files changed, 4 insertions, 0 deletions
diff --git a/lib/Target/CBackend/CBackend.cpp b/lib/Target/CBackend/CBackend.cpp
index b3b5b40..eeb2bdd 100644
--- a/lib/Target/CBackend/CBackend.cpp
+++ b/lib/Target/CBackend/CBackend.cpp
@@ -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
diff --git a/lib/Target/CBackend/Writer.cpp b/lib/Target/CBackend/Writer.cpp
index b3b5b40..eeb2bdd 100644
--- a/lib/Target/CBackend/Writer.cpp
+++ b/lib/Target/CBackend/Writer.cpp
@@ -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