build: the clang-cl cross-compile fails on gfx1013_vertex_id.cpp after the /W4 /WX ratchet #3853

Closed
opened 2026-12-02 13:21:28 +00:00 by triggered02 · 1 comment
triggered02 commented 2026-12-02 13:21:28 +00:00 (Migrated from github.com)
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-12-02T13:21:28Z.


Summary. main no longer builds with the clang-cl cross-compile documented in docs/non-windows-hosts.md. x2w_shader_compiler fails with 7 errors in src/gfx1013_vertex_id.cpp.

Cause. d654ad80 ("build: raise MSVC warnings for the shader compiler", 2026-12-01) added a warning ratchet inside if(MSVC):

if(MSVC)
    target_compile_options(x2w_shader_compiler PRIVATE /W4 /permissive-)
    target_compile_options(compile_dxil PRIVATE /W4 /permissive-)
    set_property(SOURCE src/gfx1013_isa.cpp src/gfx1013_vertex_id.cpp
        APPEND PROPERTY COMPILE_OPTIONS "$<$<STREQUAL:$<TARGET_PROPERTY:NAME>,x2w_shader_compiler>:/WX>")
endif()

CMake sets MSVC to true for clang-cl as well, because clang-cl presents the MSVC command line. So clang-cl also receives /W4 and /WX, and clang warns where MSVC does not.

Observed. Linux host, clang-cl 19.1.1 + xwin SDK splat, Release, the toolchain file from docs/non-windows-hosts.md's clang-cl section:

cmake --build out/build/clang --target d3d12_xs_shim -j 8
FAILED: CMakeFiles/x2w_shader_compiler.dir/src/gfx1013_vertex_id.cpp.obj
src/gfx1013_vertex_id.cpp(117,79): error: missing field 'value' initializer [-Werror,-Wmissing-field-initializers]
src/gfx1013_vertex_id.cpp(149,49): error: missing field 'value' initializer
src/gfx1013_vertex_id.cpp(158,43): error: missing field 'value' initializer
src/gfx1013_vertex_id.cpp(215,41): error: missing field 'value' initializer
src/gfx1013_vertex_id.cpp(216,43): error: missing field 'value' initializer
src/gfx1013_vertex_id.cpp(218,37): error: missing field 'value' initializer
src/gfx1013_vertex_id.cpp(219,37): error: missing field 'value' initializer
7 errors generated.

The compile line carries /W4 /WX for that target, confirming it is the ratchet and not a local flag: the rest of the tree compiles, and d3d12_xs_shim only fails because it depends on x2w_shader_compiler.

Why it matters. docs/non-windows-hosts.md publishes the clang-cl + xwin route as a supported way to build the eight stand-ins on Linux, and that route now stops at configure-independent build time. It is not a WARP/GPU capability issue: nothing here needs a device.

Possible fixes, whichever you prefer:

  1. limit the ratchet to real MSVC, e.g. if(MSVC AND NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang"); or
  2. keep it for clang-cl too and make the initializers explicit in gfx1013_vertex_id.cpp (7 sites, all {...} aggregate initialisations that leave value default-initialised); or
  3. add -Wno-missing-field-initializers for clang only, which keeps the /W4 ratchet's other warnings.

I hit this while rebasing an unrelated GPU PR onto 5770f14e; I have made no change for it yet. Environment: Debian, clang-cl 19.1.1, xwin SDK 10.0.26100, no Windows and no GPU involvement.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:issue:6745751520 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/3853). Originally posted by [triggered02](https://github.com/triggered02) on 2026-12-02T13:21:28Z. --- **Summary.** `main` no longer builds with the clang-cl cross-compile documented in `docs/non-windows-hosts.md`. `x2w_shader_compiler` fails with 7 errors in `src/gfx1013_vertex_id.cpp`. **Cause.** `d654ad80` ("build: raise MSVC warnings for the shader compiler", 2026-12-01) added a warning ratchet inside `if(MSVC)`: ```cmake if(MSVC) target_compile_options(x2w_shader_compiler PRIVATE /W4 /permissive-) target_compile_options(compile_dxil PRIVATE /W4 /permissive-) set_property(SOURCE src/gfx1013_isa.cpp src/gfx1013_vertex_id.cpp APPEND PROPERTY COMPILE_OPTIONS "$<$<STREQUAL:$<TARGET_PROPERTY:NAME>,x2w_shader_compiler>:/WX>") endif() ``` CMake sets `MSVC` to true for clang-cl as well, because clang-cl presents the MSVC command line. So clang-cl also receives `/W4` and `/WX`, and clang warns where MSVC does not. **Observed.** Linux host, clang-cl 19.1.1 + xwin SDK splat, Release, the toolchain file from `docs/non-windows-hosts.md`'s clang-cl section: ``` cmake --build out/build/clang --target d3d12_xs_shim -j 8 FAILED: CMakeFiles/x2w_shader_compiler.dir/src/gfx1013_vertex_id.cpp.obj src/gfx1013_vertex_id.cpp(117,79): error: missing field 'value' initializer [-Werror,-Wmissing-field-initializers] src/gfx1013_vertex_id.cpp(149,49): error: missing field 'value' initializer src/gfx1013_vertex_id.cpp(158,43): error: missing field 'value' initializer src/gfx1013_vertex_id.cpp(215,41): error: missing field 'value' initializer src/gfx1013_vertex_id.cpp(216,43): error: missing field 'value' initializer src/gfx1013_vertex_id.cpp(218,37): error: missing field 'value' initializer src/gfx1013_vertex_id.cpp(219,37): error: missing field 'value' initializer 7 errors generated. ``` The compile line carries `/W4 /WX` for that target, confirming it is the ratchet and not a local flag: the rest of the tree compiles, and `d3d12_xs_shim` only fails because it depends on `x2w_shader_compiler`. **Why it matters.** `docs/non-windows-hosts.md` publishes the clang-cl + xwin route as a supported way to build the eight stand-ins on Linux, and that route now stops at configure-independent build time. It is not a WARP/GPU capability issue: nothing here needs a device. **Possible fixes**, whichever you prefer: 1. limit the ratchet to real MSVC, e.g. `if(MSVC AND NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang")`; or 2. keep it for clang-cl too and make the initializers explicit in `gfx1013_vertex_id.cpp` (7 sites, all `{...}` aggregate initialisations that leave `value` default-initialised); or 3. add `-Wno-missing-field-initializers` for clang only, which keeps the /W4 ratchet's other warnings. I hit this while rebasing an unrelated GPU PR onto `5770f14e`; I have made no change for it yet. Environment: Debian, clang-cl 19.1.1, xwin SDK 10.0.26100, no Windows and no GPU involvement.
triggered02 commented 2026-12-02 13:21:44 +00:00 (Migrated from github.com)
Author
Contributor

Imported from R0Y00/Xbox2Windows. Originally posted by triggered02 on 2026-12-02T13:21:44Z.


Claiming this since I hit it and it blocks my other work.

Slice: the if(MSVC) guard around the /W4 /permissive- + /WX ratchet in CMakeLists.txt. CMake sets MSVC for clang-cl too, so the ratchet reaches a compiler it was not written for. I will make the ratchet apply to real MSVC and leave clang-cl out of it, which matches the commit's own wording ("raise MSVC warnings for the shader compiler").

Environment: Debian, clang-cl 19.1.1, xwin SDK 10.0.26100, Release — the clang-cl route documented in docs/non-windows-hosts.md. No Windows, no GPU, no D3D12 device needed to reproduce.

Verification I can offer: before/after cmake --build out/build/clang --target d3d12_xs_shim on this host — fails with the 7 -Wmissing-field-initializers errors before, builds after. I cannot produce MSVC evidence, so the MSVC side of the ratchet will be unchanged-by-inspection only.

Overlap: none — the issue is seconds old and unassigned.

If you would rather keep /W4 /WX for clang-cl and silence just this warning class (-Wno-missing-field-initializers for clang only), say so and I will switch the approach; that keeps clang coverage at the cost of one suppression.

<!-- greyfinch-sync:R0Y00/Xbox2Windows:comment:7346754677 --> Imported from [R0Y00/Xbox2Windows](https://github.com/R0Y00/Xbox2Windows/issues/3853#issuecomment-7346754677). Originally posted by [triggered02](https://github.com/triggered02) on 2026-12-02T13:21:44Z. --- Claiming this since I hit it and it blocks my other work. **Slice:** the `if(MSVC)` guard around the `/W4 /permissive-` + `/WX` ratchet in `CMakeLists.txt`. CMake sets `MSVC` for clang-cl too, so the ratchet reaches a compiler it was not written for. I will make the ratchet apply to real MSVC and leave clang-cl out of it, which matches the commit's own wording ("raise MSVC warnings for the shader compiler"). **Environment:** Debian, clang-cl 19.1.1, xwin SDK 10.0.26100, Release — the clang-cl route documented in `docs/non-windows-hosts.md`. No Windows, no GPU, no D3D12 device needed to reproduce. **Verification I can offer:** before/after `cmake --build out/build/clang --target d3d12_xs_shim` on this host — fails with the 7 `-Wmissing-field-initializers` errors before, builds after. I cannot produce MSVC evidence, so the MSVC side of the ratchet will be unchanged-by-inspection only. **Overlap:** none — the issue is seconds old and unassigned. If you would rather keep `/W4 /WX` for clang-cl and silence just this warning class (`-Wno-missing-field-initializers` for clang only), say so and I will switch the approach; that keeps clang coverage at the cost of one suppression.
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
R0Y00/Xbox2Windows#3853
No description provided.