diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2014-09-04 09:49:44 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2014-09-04 09:49:44 +0300 |
commit | 7448f28d356fc5cd8d9117111baea3a549e0930e (patch) | |
tree | f24d82d8b121d8321cfc0366dabad236d3f3dac3 /profile.c | |
parent | a205df7903bce201577df4f7049c190e283f1ea4 (diff) | |
parent | 8beb9796b17b6ca48eb62df8fd3d31421e43c761 (diff) | |
download | egawk-7448f28d356fc5cd8d9117111baea3a549e0930e.tar.gz egawk-7448f28d356fc5cd8d9117111baea3a549e0930e.tar.bz2 egawk-7448f28d356fc5cd8d9117111baea3a549e0930e.zip |
Merge branch 'gawk-4.1-stable'
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); |