]> git.rm.cloudns.org Git - xonotic/gmqcc.git/commitdiff
Since we currently append AINSTR_END to the end of all functions for debugging purpos...
authorWolfgang (Blub) Bumiller <blub@speed.at>
Tue, 21 Aug 2012 16:12:01 +0000 (18:12 +0200)
committerWolfgang (Blub) Bumiller <blub@speed.at>
Tue, 21 Aug 2012 16:12:01 +0000 (18:12 +0200)
ir.c

diff --git a/ir.c b/ir.c
index 80d53ed8152c3ffcf463bbf035af9796ad7393a5..23064cbcd8a4baae1ef1ad722367e595b8c35931 100644 (file)
--- 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);
 }