From 671aceb40f6b64e6bfea41c08d6e1b3747a0f3e4 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Sun, 7 Jun 2020 17:10:34 -0400 Subject: opt: Warn when no side effects are reachable --- opt.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'opt.c') diff --git a/opt.c b/opt.c index 14996f2..65520dd 100644 --- a/opt.c +++ b/opt.c @@ -1000,10 +1000,6 @@ int optimize_cmdline(struct cmdline *cmdline) { return -1; } - if (cmdline->exclude->always_true) { - bfs_warning(cmdline, "${red}-exclude${rs} applies to all files.\n"); - } - // Only non-excluded files are evaluated state.facts = state.facts_when_false; @@ -1018,6 +1014,10 @@ int optimize_cmdline(struct cmdline *cmdline) { cmdline->expr = ignore_result(&state, cmdline->expr); + if (facts_are_impossible(&facts_when_impure)) { + bfs_warning(cmdline, "This command won't do anything.\n"); + } + const struct range *depth_when_impure = &facts_when_impure.ranges[DEPTH_RANGE]; long long mindepth = depth_when_impure->min; long long maxdepth = depth_when_impure->max; -- cgit v1.2.3