Skip to content

obs-c-oracle: MSVC build stops on C4200 (flexible array in obs-internal.h) with -W4 -WX #1427

Closed

Description

@vpacher

Context and reproduction

On Windows with MSVC, cargo bench -p obs-c-oracle --bench port_comparison (and every other build of obs-c-oracle) stops on master bf85ddf:

libobs\obs-internal.h(1227): warning C4200: nonstandard extension used: zero-sized array in struct/union
libobs\obs-internal.h(1227): error C2220: the following warning is treated as an error

The file is rust/obs-c-oracle/oracle/audio_io_windows.c (it includes obs-internal.h). Environment: Windows 11 LTSC x64, VS 2022 Build Tools, MSVC 14.44.35207, Windows SDK 10.0.26100, Rust 1.98.1 x86_64-pc-windows-msvc.

Cause

struct caption_text has a C99 flexible array member, char text[]; (from b85fd69, "libobs: word-wrap and paginate caption text instead of truncating", 2026-10-12). MSVC reports C4200 for it. rust/obs-c-oracle/build.rs compiles the oracle with -W4 -WX for MSVC. The shipped libobs build uses /W3 (cmake/windows/compilerconfig.cmake). I did not check whether /W3 also reports C4200.

I found no workflow that builds obs-c-oracle with MSVC (a search of .github/workflows for obs-c-oracle and port_comparison). That is probably why this was not seen.

Proposed fix

In build.rs, in the is_like_msvc() block next to /wd4702 and /wd4127: add /wd4200, with a comment that the flexible array is valid C11. Alternatively, keep the warning and change /WX handling only for this header. I prefer /wd4200 because the code is correct C.

Workaround until then: CFLAGS_x86_64_pc_windows_msvc=/wd4200. With it, the oracle builds and port_comparison runs (I used it for the Windows numbers in #1303).

Test

A build of obs-c-oracle with MSVC is the test. A CI lane for it is a separate question.

🤖 Generated with Claude Code

Activity

  1. zackees commented on Oct 20, 2026

    @zackees
    Member

    Claiming: MSVC oracle flexible-array build failure.

    1. Add a focused regression check for strict oracle MSVC flags.
    2. Suppress C4200 for the C11 flexible array while retaining warnings as errors.
    3. Validate locally and open a PR today; Windows PR CI will verify the native compiler build.
  2. added
    claimed
    on Oct 20, 2026
  3. zackees commented on Oct 20, 2026

    @zackees
    Member

    Fixed by #1563 (merged as 6853332). The oracle now suppresses MSVC C4200 for its C11 flexible array while preserving /W4 /WX. The RED configuration regression check passes with the fix. Native Windows workspace tests, Clippy, and formatting all passed in job https://github.com/obs-rust/obs-studio/actions/runs/39498362355/job/118891758352. No work remains for this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    claimed

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions