Files
scc 9c04b2e1a5 fix(msvc): handle all per-warning cl.exe options
cl.exe accepts a warning-number argument either glued (/wd4995) or as
a separate token (/wd 4995); the latter form is widely used in nmake
Makefiles. Three gaps on the current 4.1.2-rc tip:

1. `/wd*`, `/we*`, `/wo*` used a plain prefix pattern that matches the
   glued form only. When bear saw "/wd 4995", the flag consumed zero
   extra args and the trailing numeric token was reclassified as a
   Source and dropped from compile_commands.json. clangd then emitted
   drv_invalid_int_value for every translation unit.

2. `/w1nnnn`, `/w2nnnn`, `/w3nnnn`, `/w4nnnn` (set warning level for a
   specific warning) were not defined at all, so `/w1 4326` was split
   into an unknown flag plus an orphan numeric token.

3. `/Wv[:version]` was not defined. Both the bare `/Wv` form (cl uses
   the current compiler version when omitted) and `/Wv:17` were
   affected.

All three classes are documented on the MS warning-level options page:
https://learn.microsoft.com/en-us/cpp/build/reference/compiler-option-warning-level

Fix:
  * /wd*, /we*, /wo*  ->  /wd{ }*, /we{ }*, /wo{ }*
    (ExactlyWithGluedOrSep, matching /D, /I, /U, /FI).
  * Add /w1{ }*, /w2{ }*, /w3{ }*, /w4{ }*.
  * Add /Wv (exact) plus /Wv:* (ExactlyWithColon, required value).

clang_cl.yaml inherits the fix via `extends: msvc`. Codegen snapshot
fixtures updated accordingly.

Two integration tests in integration-tests/tests/cases/semantic.rs
cover all three classes.

Manually verified by scc-tw <scc@scc.tw>.
Closes: #690

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-21 20:49:57 +10:00
..