aboutsummaryrefslogtreecommitdiffstats
path: root/profile.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2014-09-04 09:49:44 +0300
committerArnold D. Robbins <arnold@skeeve.com>2014-09-04 09:49:44 +0300
commit7448f28d356fc5cd8d9117111baea3a549e0930e (patch)
treef24d82d8b121d8321cfc0366dabad236d3f3dac3 /profile.c
parenta205df7903bce201577df4f7049c190e283f1ea4 (diff)
parent8beb9796b17b6ca48eb62df8fd3d31421e43c761 (diff)
downloadegawk-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.c30
1 files changed, 19 insertions, 11 deletions
diff --git a/profile.c b/profile.c
index eae24b1c..d07bea4a 100644
--- a/profile.c
+++ b/profile.c
@@ -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);