diff --git a/c2logic/compiler.py b/c2logic/compiler.py index 5d684ff..aa8ffd5 100644 --- a/c2logic/compiler.py +++ b/c2logic/compiler.py @@ -415,7 +415,10 @@ class Compiler(c_ast.NodeVisitor): self.push(RelativeJump(self.loops[-1].start, JumpCondition.always)) def visit_Return(self, node): - self.visit(node.expr) + if node.expr is None: + self.push(Set("__rax","null")) + else: + self.visit(node.expr) self.push_ret() def visit_Label(self, node): diff --git a/include/io.h b/include/io.h new file mode 100644 index 0000000..1caa69d --- /dev/null +++ b/include/io.h @@ -0,0 +1,11 @@ +#ifndef IO_H +#define IO_H +void println(char* s) { + print(s); + print("\n"); +} +void printdln(double s) { + printd(s); + print("\n"); +} +#endif \ No newline at end of file