Skip to content

Driver: build, test and analyze refuse an unknown option, as check, ir and run do (#2634, #1097) - #2639

Merged
ehartford merged 1 commit into
fix-2635from
fix-2634
Oct 25, 2026
Merged

ehartford merged 1 commit into
fix-2635from
fix-2634

Conversation

@ehartford

@ehartford ehartford commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Root cause: src/main.w run_cli applied the #2198 unknown-flag refusal only
when cli_cmd == "check" or cli_cmd == "ir" or cli_cmd == "run"; every
other command ignored a flag it did not know. with build x.w --emit-llvm -o x.ll wrote a Mach-O executable to x.ll (#1097), and build, test and
analyze exited 0 over any misspelled flag (#2634).

The condition now covers build, test and analyze; cli_known_flags already
holds every flag those commands parse (DriverOptions), and run keeps
trimming the program's own arguments (cli_driver_argc).

Evidence (stage1 of this tree, test/hello.w):
before build --emit-llvm rc=0; build/test --no-such-flag-2634 rc=0
after error: unknown option --emit-llvm for with build (rc=2)
error: unknown option --no-such-flag-2634 for with test (rc=2), likewise build and analyze

Test: deep-debug-tool-tests (build.w deep_debug_unknown_flag_refused) now
checks check, build (twice), test and analyze.

Closes #2634 1097

…r and run do (#2634, #1097)

Root cause: src/main.w run_cli applied the #2198 unknown-flag refusal only
when `cli_cmd == "check" or cli_cmd == "ir" or cli_cmd == "run"`; every
other command ignored a flag it did not know. `with build x.w --emit-llvm
-o x.ll` wrote a Mach-O executable to x.ll (#1097), and `build`, `test` and
`analyze` exited 0 over any misspelled flag (#2634).

The condition now covers build, test and analyze; cli_known_flags already
holds every flag those commands parse (DriverOptions), and `run` keeps
trimming the program's own arguments (cli_driver_argc).

Evidence (stage1 of this tree, test/hello.w):
before  build --emit-llvm rc=0; build/test --no-such-flag-2634 rc=0
after   error: unknown option `--emit-llvm` for `with build` (rc=2)
        error: unknown option `--no-such-flag-2634` for `with test` (rc=2), likewise build and analyze

Test: deep-debug-tool-tests (build.w deep_debug_unknown_flag_refused) now
checks check, build (twice), test and analyze.
@ehartford
ehartford added this pull request to stack #2645 October 25, 2026 19:58
@ehartford ehartford changed the title fix 2634 Driver: build, test and analyze refuse an unknown option, as check, ir and run do (#2634, #1097) Oct 25, 2026
@ehartford
ehartford marked this pull request as ready for review October 25, 2026 20:07
@ehartford
ehartford merged commit be37e17 into main Oct 25, 2026
@ehartford
ehartford deleted the fix-2634 branch October 25, 2026 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

with build, with test and with analyze silently accept unknown options (check and run refuse them)

1 participant