From: Wolfgang (Blub) Bumiller Date: Tue, 21 Aug 2012 16:12:01 +0000 (+0200) Subject: Since we currently append AINSTR_END to the end of all functions for debugging purpos... X-Git-Tag: 0.1-rc1~113 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=1f32fe1d8a438a4888a5fa493874b089eeac931c;p=xonotic%2Fgmqcc.git Since we currently append AINSTR_END to the end of all functions for debugging purposes, and darkplaces complains when the very last statement isn't INSTR_DONE or INSTR_RETURN, we append an INSTR_DONE at the very end --- diff --git a/ir.c b/ir.c index 80d53ed..23064cb 100644 --- a/ir.c +++ b/ir.c @@ -2805,6 +2805,7 @@ static bool ir_builder_gen_field(ir_builder *self, ir_value *field) bool ir_builder_generate(ir_builder *self, const char *filename) { + prog_section_statement stmt; size_t i; code_init(); @@ -2833,6 +2834,17 @@ bool ir_builder_generate(ir_builder *self, const char *filename) } } + /* DP errors if the last instruction is not an INSTR_DONE + * and for debugging purposes we add an additional AINSTR_END + * to the end of functions, so here it goes: + */ + stmt.opcode = INSTR_DONE; + stmt.o1.u1 = 0; + stmt.o2.u1 = 0; + stmt.o3.u1 = 0; + if (code_statements_add(stmt) < 0) + return false; + printf("writing '%s'...\n", filename); return code_write(filename); }