From d6b38dd0eeb0c923f7572d907338fd0940317622 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Mon, 26 Nov 2012 21:00:28 +0900 Subject: [PATCH] Add an option to control expr tree dumping. About bloody time :P --- tools/qfcc/include/options.h | 1 + tools/qfcc/source/dot_expr.c | 2 +- tools/qfcc/source/options.c | 3 +++ tools/qfcc/source/statements.c | 4 ++-- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/tools/qfcc/include/options.h b/tools/qfcc/include/options.h index 3dd4bd7fb..9c8d10724 100644 --- a/tools/qfcc/include/options.h +++ b/tools/qfcc/include/options.h @@ -73,6 +73,7 @@ typedef struct { qboolean dead; qboolean final; qboolean dags; + qboolean expr; qboolean flow; qboolean post; } blockdot_options_t; diff --git a/tools/qfcc/source/dot_expr.c b/tools/qfcc/source/dot_expr.c index 69b2e33aa..5afd28e1d 100644 --- a/tools/qfcc/source/dot_expr.c +++ b/tools/qfcc/source/dot_expr.c @@ -175,7 +175,7 @@ print_bool (dstring_t *dstr, expr_t *e, int level, int id, expr_t *next) dasprintf (dstr, "%*s%sf\n", indent, "", i == count ? va ("", - bool->true_list->size - count) + bool->false_list->size - count) : "", i); dasprintf (dstr, "%*s\n", indent + 2, ""); diff --git a/tools/qfcc/source/options.c b/tools/qfcc/source/options.c index 7546362a0..448fbb97e 100644 --- a/tools/qfcc/source/options.c +++ b/tools/qfcc/source/options.c @@ -391,6 +391,8 @@ DecodeArgs (int argc, char **argv) options.block_dot.final = flag; } else if (!(strcasecmp (temp, "dags"))) { options.block_dot.dags = flag; + } else if (!(strcasecmp (temp, "expr"))) { + options.block_dot.expr = flag; } else if (!(strcasecmp (temp, "flow"))) { options.block_dot.flow = flag; } else if (!(strcasecmp (temp, "post"))) { @@ -405,6 +407,7 @@ DecodeArgs (int argc, char **argv) options.block_dot.dead = true; options.block_dot.final = true; options.block_dot.dags = true; + options.block_dot.expr = true; options.block_dot.flow = true; options.block_dot.post = true; } diff --git a/tools/qfcc/source/statements.c b/tools/qfcc/source/statements.c index 12a634a0d..e8cf85700 100644 --- a/tools/qfcc/source/statements.c +++ b/tools/qfcc/source/statements.c @@ -1442,8 +1442,8 @@ sblock_t * make_statements (expr_t *e) { sblock_t *sblock = new_sblock (); - //sblock_t *s; - //dump_dot ("expr", e, dump_dot_expr); + if (options.block_dot.expr) + dump_dot ("expr", e, dump_dot_expr); statement_slist (sblock, e); if (options.block_dot.initial) dump_dot ("initial", sblock, dump_dot_sblock);