diff options
author | Stephen Davies <sdavies@sdc.com.au> | 2014-09-11 16:26:34 +0930 |
---|---|---|
committer | Stephen Davies <sdavies@sdc.com.au> | 2014-09-11 16:26:34 +0930 |
commit | 33acaac51cd9087eb7a9b7e73c11f58da396df9a (patch) | |
tree | 31f31fcbddca399940865007322bdeea81f2f6f7 /profile.c | |
parent | 9b21de890a81179e951ffa5bea2099673f584b16 (diff) | |
parent | ca9f23d6c33c4b5cb3786d480948a42988ca99ac (diff) | |
download | egawk-33acaac51cd9087eb7a9b7e73c11f58da396df9a.tar.gz egawk-33acaac51cd9087eb7a9b7e73c11f58da396df9a.tar.bz2 egawk-33acaac51cd9087eb7a9b7e73c11f58da396df9a.zip |
Merge branch 'master' of ssh://git.sv.gnu.org/srv/git/gawk
Conflicts:
doc/gawk.info
Diffstat (limited to 'profile.c')
-rw-r--r-- | profile.c | 30 |
1 files changed, 19 insertions, 11 deletions
@@ -731,20 +731,28 @@ cleanup: ip = pc + 1; indent(ip->forloop_body->exec_count); fprintf(prof_fp, "%s (", op2str(pc->opcode)); - pprint(pc->nexti, ip->forloop_cond, true); - fprintf(prof_fp, "; "); - if (ip->forloop_cond->opcode == Op_no_op && - ip->forloop_cond->nexti == ip->forloop_body) + /* If empty for looop header, print it a little more nicely. */ + if ( pc->nexti->opcode == Op_no_op + && ip->forloop_cond == pc->nexti + && pc->target_continue->opcode == Op_jmp) { + fprintf(prof_fp, ";;"); + } else { + pprint(pc->nexti, ip->forloop_cond, true); fprintf(prof_fp, "; "); - else { - pprint(ip->forloop_cond, ip->forloop_body, true); - t1 = pp_pop(); - fprintf(prof_fp, "%s; ", t1->pp_str); - pp_free(t1); - } - pprint(pc->target_continue, pc->target_break, true); + if (ip->forloop_cond->opcode == Op_no_op && + ip->forloop_cond->nexti == ip->forloop_body) + fprintf(prof_fp, "; "); + else { + pprint(ip->forloop_cond, ip->forloop_body, true); + t1 = pp_pop(); + fprintf(prof_fp, "%s; ", t1->pp_str); + pp_free(t1); + } + + pprint(pc->target_continue, pc->target_break, true); + } fprintf(prof_fp, ") {\n"); indent_in(); pprint(ip->forloop_body->nexti, pc->target_continue, false); |