diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2020-06-07 17:10:34 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2020-06-07 17:14:28 -0400 |
commit | 671aceb40f6b64e6bfea41c08d6e1b3747a0f3e4 (patch) | |
tree | f5fee8d8696058aa2c99c0fc806dd41a1a8a215e | |
parent | 527d49a18979bc04992af5864034af57495a2f0b (diff) | |
download | bfs-671aceb40f6b64e6bfea41c08d6e1b3747a0f3e4.tar.xz |
opt: Warn when no side effects are reachable
-rw-r--r-- | opt.c | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -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; |