From 5026a144add526567771a75b414a4d9873054620 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Sat, 26 Mar 2022 16:34:53 -0400 Subject: opt: Warn about expressions we remove while optimizing --- parse.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'parse.c') diff --git a/parse.c b/parse.c index 0019987..87d73e3 100644 --- a/parse.c +++ b/parse.c @@ -79,6 +79,7 @@ struct bfs_expr bfs_true = { .argv = &fake_true_arg, .pure = true, .always_true = true, + .synthetic = true, .cost = FAST_COST, .probability = 1.0, }; @@ -89,6 +90,7 @@ struct bfs_expr bfs_false = { .argv = &fake_false_arg, .pure = true, .always_false = true, + .synthetic = true, .cost = FAST_COST, .probability = 0.0, }; @@ -127,6 +129,7 @@ struct bfs_expr *bfs_expr_new(bfs_eval_fn *eval_fn, size_t argc, char **argv) { expr->pure = false; expr->always_true = false; expr->always_false = false; + expr->synthetic = false; expr->cost = FAST_COST; expr->probability = 0.5; expr->evaluations = 0; @@ -1860,6 +1863,7 @@ static struct bfs_expr *parse_nohidden(struct parser_state *state, int arg1, int hidden->probability = 0.01; hidden->pure = true; + hidden->synthetic = true; struct bfs_ctx *ctx = state->ctx; ctx->exclude = new_binary_expr(eval_or, ctx->exclude, hidden, &fake_or_arg); @@ -3484,6 +3488,7 @@ static struct bfs_expr *parse_whole_expr(struct parser_state *state) { goto fail; } init_print_expr(state, print); + print->synthetic = true; expr = new_binary_expr(eval_and, expr, print, &fake_and_arg); if (!expr) { -- cgit v1.2.3