aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@home.transmeta.com>2003-05-17 12:14:58 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-07 21:00:41 -0700
commit12937419faf5d0a0e9ee5623064182c4bdfc3650 (patch)
treebbc51acf4f29269d94a1d5dbf8495e266db0be75
parentec69546dc4d1d3fd8853544d0c39af00799dadf3 (diff)
downloadsparse-12937419faf5d0a0e9ee5623064182c4bdfc3650.tar.gz
sparse-12937419faf5d0a0e9ee5623064182c4bdfc3650.tar.xz
sparse-12937419faf5d0a0e9ee5623064182c4bdfc3650.zip
Make the switch case table printout look prettier and more readable
(it's really indexed by the case value, not the label value, so make that part more intuitive)
-rw-r--r--show-parse.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/show-parse.c b/show-parse.c
index fdceb4b..d0619de 100644
--- a/show-parse.c
+++ b/show-parse.c
@@ -352,18 +352,17 @@ static void show_switch_statement(struct statement *stmt)
* cases to decide whether to use a lookup table or a
* series of comparisons etc
*/
- printf("case list:\n");
+ printf("# case table:\n");
FOR_EACH_PTR(stmt->switch_case->symbol_list, sym) {
struct statement *case_stmt = sym->stmt;
struct expression *expr = case_stmt->case_expression;
struct expression *to = case_stmt->case_to;
- printf(" .L%p: ", sym);
if (!expr) {
- printf(" default");
+ printf(" default");
} else {
if (expr->type == EXPR_VALUE) {
- printf(" %lld", expr->value);
+ printf(" case %lld", expr->value);
if (to) {
if (to->type == EXPR_VALUE) {
printf(" .. %lld", to->value);
@@ -372,10 +371,11 @@ static void show_switch_statement(struct statement *stmt)
}
}
} else
- printf(" what?");
+ printf(" what?");
}
- printf("\n");
+ printf(": .L%p\n", sym);
} END_FOR_EACH_PTR;
+ printf("# end case table\n");
if (stmt->switch_break->used)
printf(".L%p:\n", stmt->switch_break);