From ea94de076d11090b20089a73378fc19704443f0e Mon Sep 17 00:00:00 2001 From: Stefano Sanfilippo Date: Mon, 9 Mar 2015 13:52:34 +0100 Subject: [PATCH] Force return type of main to int in CppEmitter. --- CppEmitter.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CppEmitter.cpp b/CppEmitter.cpp index 24de662..f98cc19 100644 --- a/CppEmitter.cpp +++ b/CppEmitter.cpp @@ -321,7 +321,11 @@ bool CppEmitter::emit(Module const& module) { } bool CppEmitter::emit(FunctionPrototype const& proto) { - stream << proto.getType() << ' '; + if (proto.getName().getValue() == "main") { + stream << "int "; + } else { + stream << proto.getType() << ' '; + } GUARDED(proto.getName().emit(this)); stream << "("; emitFunctionParams(proto.getArgs());