summaryrefslogtreecommitdiffstats
path: root/opt.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2020-06-07 17:10:34 -0400
committerTavian Barnes <tavianator@tavianator.com>2020-06-07 17:14:28 -0400
commit671aceb40f6b64e6bfea41c08d6e1b3747a0f3e4 (patch)
treef5fee8d8696058aa2c99c0fc806dd41a1a8a215e /opt.c
parent527d49a18979bc04992af5864034af57495a2f0b (diff)
downloadbfs-671aceb40f6b64e6bfea41c08d6e1b3747a0f3e4.tar.xz
opt: Warn when no side effects are reachable
Diffstat (limited to 'opt.c')
-rw-r--r--opt.c8
1 files changed, 4 insertions, 4 deletions
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;