mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2025-01-18 22:31:36 +00:00
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
This commit is contained in:
parent
9eb9c99e72
commit
1f32fe1d8a
1 changed files with 12 additions and 0 deletions
12
ir.c
12
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)
|
bool ir_builder_generate(ir_builder *self, const char *filename)
|
||||||
{
|
{
|
||||||
|
prog_section_statement stmt;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
code_init();
|
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);
|
printf("writing '%s'...\n", filename);
|
||||||
return code_write(filename);
|
return code_write(filename);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue