Force return type of main to int in CppEmitter.

This commit is contained in:
Stefano Sanfilippo 2015-03-09 13:52:34 +01:00
parent e46ddfcd80
commit ea94de076d

View File

@ -321,7 +321,11 @@ bool CppEmitter::emit(Module const& module) {
} }
bool CppEmitter::emit(FunctionPrototype const& proto) { bool CppEmitter::emit(FunctionPrototype const& proto) {
if (proto.getName().getValue() == "main") {
stream << "int ";
} else {
stream << proto.getType() << ' '; stream << proto.getType() << ' ';
}
GUARDED(proto.getName().emit(this)); GUARDED(proto.getName().emit(this));
stream << "("; stream << "(";
emitFunctionParams(proto.getArgs()); emitFunctionParams(proto.getArgs());