summaryrefslogtreecommitdiff
path: root/profile.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2022-04-21 17:26:21 +0300
committerArnold D. Robbins <arnold@skeeve.com>2022-04-21 17:26:21 +0300
commit6cf92b53d37c1f9e3029cb1c8c0217100c7e36d8 (patch)
treedb9fc3d394519563ce81129911088aeef9992e55 /profile.c
parent2b4d1c796f24d1fc2fb09bd1570f859caabda419 (diff)
downloadgawk-6cf92b53d37c1f9e3029cb1c8c0217100c7e36d8.tar.gz
Pretty printing improvements for comments in switch/case.
Diffstat (limited to 'profile.c')
-rw-r--r--profile.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/profile.c b/profile.c
index 15b33721..66932db6 100644
--- a/profile.c
+++ b/profile.c
@@ -998,9 +998,11 @@ cleanup:
fprintf(prof_fp, "%s (", op2str(pc->opcode));
pprint(pc->nexti, ip1->switch_start, NO_PPRINT_FLAGS);
t1 = pp_pop();
- fprintf(prof_fp, "%s) {\n", t1->pp_str);
+ fprintf(prof_fp, "%s) {", t1->pp_str);
if (pc->comment)
print_comment(pc->comment, 0);
+ else
+ fprintf(prof_fp, "\n");
pp_free(t1);
pprint(ip1->switch_start, ip1->switch_end, NO_PPRINT_FLAGS);
indent(SPACEOVER);
@@ -1022,9 +1024,11 @@ cleanup:
indent_in();
if (pc->comment != NULL) {
- if (pc->comment->memory->comment_type == EOL_COMMENT)
+ if (pc->comment->memory->comment_type == EOL_COMMENT) {
fprintf(prof_fp, "\t%s", pc->comment->memory->stptr);
- else {
+ if (pc->comment->comment != NULL)
+ print_comment(pc->comment->comment, indent_level);
+ } else {
fprintf(prof_fp, "\n");
print_comment(pc->comment, indent_level);
}