Skip to content

ci: Lint CMake for GCC/Clang -W options that would reach MSVC (#634 item 8) - #719

Merged
zackees merged 2 commits into
masterfrom
ci/634-msvc-flag-lint
Oct 14, 2026
Merged

zackees merged 2 commits into
masterfrom
ci/634-msvc-flag-lint

Conversation

@zackees

@zackees zackees commented Oct 14, 2026

Copy link
Copy Markdown
Member

Refs #634 (item 8)

MSVC rejects unknown -W... options (D8021), and GCC pragmas or flags that slip through fail the Windows build last (#570/#571).

ci/msvc_flags.py parses CMake commands, including multi-line if/elseif chains. It reports a -W option given to target_compile_options, add_compile_options or a COMPILE_OPTIONS property unless one of these guards it:

  • a generator expression ($<$<C_COMPILER_ID:GNU,Clang>:-Wno-x>)
  • a branch that excludes MSVC (NOT MSVC, a GNU/Clang compiler id, OS_LINUX/OS_MACOS/APPLE/..., or the else() of a branch that covers Windows)
  • a platform-only file (cmake/{macos,linux}/, os-*.cmake, plugins/{mac,linux}-*, sndio)

Options kept in variables are not followed. ci/test_msvc_flags.py runs it in ./lint (ci/test_*.py).

RED → GREEN

  • RED: the test commit fails at import (no checker).
  • GREEN: 13/13 pass. Synthetic cases cover bare flags, multi-line calls, COMPILE_OPTIONS properties, Windows branches and else() inversion. The repository scan is clean (uv run ci/msvc_flags.py exits 0), and ./lint is ok.

@zackees
zackees enabled auto-merge October 14, 2026 09:11
ci/msvc_flags.py parses CMake commands and if() chains and reports a -W
option given to target_compile_options, add_compile_options or a
COMPILE_OPTIONS property outside a compiler-id generator expression, a
branch that excludes MSVC, or a platform-only file. ci/test_msvc_flags.py
runs it in ./lint; master has no such option today.

Refs #634
@zackees
zackees force-pushed the ci/634-msvc-flag-lint branch from 3729e23 to 35686b7 Compare October 14, 2026 09:12
@zackees
zackees added this pull request to the merge queue Oct 14, 2026
Merged via the queue into master with commit e29bb0f Oct 14, 2026
20 checks passed
@zackees
zackees deleted the ci/634-msvc-flag-lint branch October 26, 2026 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant