Skip to content

obs-c-oracle: Allow MinGW isfinite float casts - #2665

Merged
rdoupe merged 2 commits into
masterfrom
fix/2648-bug-obs-c-oracle-windows-gnu-ora
Oct 27, 2026
Merged

rdoupe merged 2 commits into
masterfrom
fix/2648-bug-obs-c-oracle-windows-gnu-ora

Conversation

@rdoupe

@rdoupe rdoupe commented Oct 27, 2026

Copy link
Copy Markdown
Collaborator

Fixes #2648

What and why

Since -Wconversion joined the C oracle's STRICT_FLAGS (#2632), the x86_64-pc-windows-gnu build of obs-c-oracle (mingw-w64 GCC 15.3.0) stops in audio-math.h's db_to_mul(), so the local gate's rust-test lane fails on master in its windows-gnu --no-run step:

libobs/media-io/audio-math.h:38:25: error: conversion from 'double' to 'float' may change value [-Werror=float-conversion]
   38 |         return isfinite((double)db) ? powf(10.0f, db / 20.0f) : 0.0f;

MinGW's isfinite() is a type-generic macro whose float branch casts its argument to float; GCC checks that branch even though a double never takes it. glibc's isfinite() is a builtin, and MSVC doesn't get the flag, so only this target sees it.

audio-math.h is a public libobs header, so it stays as it is. Instead rust/obs-c-oracle/build.rs adds -Wno-float-conversion for the windows-gnu oracle only, with a comment naming this issue. The Linux GCC, clang and macOS builds of the oracle keep the full -Wconversion check. No code the oracle compiles changes.

No upstream issue.

RED → GREEN

  • RED commit: b1eff2d adds ci/test_oracle_mingw.py, which compiles oracle/audio_math.c with build.rs's warning flags and its windows-gnu flags, using the MinGW GCC soldr builds the oracle with (it skips when none is installed). On RED it fails, FAIL: test_audio_math_compiles_with_windows_gnu_flags, with the -Werror=float-conversion error above, and it is the only failure in --lane lint. soldr cargo build -p obs-c-oracle --target x86_64-pc-windows-gnu --locked fails the same way. This is a focused build configuration fix, so the RED evidence is local and RED and GREEN are pushed together.
  • GREEN: the test passes and the same build finishes clean. uv run ci/local_gate.py --lane rust-test passes: 4665 passed, 6 skipped, then 845 passed, 0 skipped, and the windows-gnu --no-run builds every test. --test-diff origin/master: 4390 passed, 6 skipped. --lane lint (with the new test) and --lane cross pass, and soldr cargo clippy --workspace --target x86_64-pc-windows-msvc --all-targets --locked -- -D warnings is clean. Tier 2 (--lane tier2-linux): 581/581 passed, 8 skipped (PulseAudio and v4l2 vivid device tests). The local gate passed every lane and stamped the head (lint, rust-test, cross, tier2-linux). Runs were on de8ac3e.
  • Real app (UI, protocol output or logging changes): N/A, test-only oracle build flags.

Checklist

  • Base is master (or the description starts with a Stacked: note)
  • I claimed the issue, or no one else has an open PR for it
  • Characterization test (if the unit had none), then RED, then GREEN commits (N/A for docs-only; a focused CI fix may push RED and GREEN together)
  • User-visible change: its line in docs/features.md is added or updated (not applicable: no user-visible change)
  • (Optional) Local gate passed and the pushed head is stamped; otherwise PR CI runs the full suite
  • Warning or flag changes (-W..., ratchets): built with scripting ON (PR CI builds no OBS app: run gh workflow run ci.yml --ref <branch> for the full builds) and cross-checked with clang and MSVC (the flag is added for the windows-gnu oracle only; no OBS app target and no clang or MSVC build sees it. Linux GCC, macOS clang via --lane cross, and MSVC clippy all built clean)
  • Intentional differences from C listed in the parity test header and rust/README.md (ports) (N/A: not a port)

Since -Wconversion joined the C oracle's STRICT_FLAGS (#2632), the
windows-gnu oracle build stops in audio-math.h's db_to_mul():

  audio-math.h:38:25: error: conversion from 'double' to 'float' may
  change value [-Werror=float-conversion]

Add a test that compiles oracle/audio_math.c with build.rs's warning
flags and its windows-gnu flags, using the MinGW GCC soldr builds the
oracle with (15.3.0 here). It skips when no MinGW GCC is installed.
It fails until the windows-gnu flags handle MinGW's isfinite().

Refs #2648.
Since -Wconversion joined STRICT_FLAGS (#2632), the windows-gnu build
of the oracle stops in audio-math.h's db_to_mul():

  audio-math.h:38:25: error: conversion from 'double' to 'float' may
  change value [-Werror=float-conversion]

MinGW's isfinite() is a type-generic macro whose float branch casts
its argument to float, and GCC checks that branch even for a double.
audio-math.h is a public header, so leave it alone and turn off
-Wfloat-conversion for the windows-gnu oracle only. The Linux GCC,
clang and macOS builds keep the check.

Fixes #2648.

Local-Gate: v1 tree=1781bdd13482bba1ace2d93c6b343f5bf5fae7f8 secs=2389 lanes=lint:run,rust-test:run,cross:run,tier2-linux:run
Ci-Attestation: {"at":1793119525,"gate":"rust/all/fmt","host":"linux-x86_64","key":"63fd6734b0385def17d28b77c052752f9bc93577f72508e9c77d1f4b69edcd1b","lane":"lint","parents":["b1eff2d60b0c233caf75d06ff2c75d76d35b2f44"],"secs":55,"stamp":"5f3882a13b4ec9bf30b28c3a2cf2541d","tree":"1781bdd13482bba1ace2d93c6b343f5bf5fae7f8","v":1,"via":"run"}
Ci-Attestation: {"at":1793119525,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"63fd6734b0385def17d28b77c052752f9bc93577f72508e9c77d1f4b69edcd1b","lane":"lint","parents":["b1eff2d60b0c233caf75d06ff2c75d76d35b2f44"],"secs":55,"stamp":"7ba1beec8efdd8003885c951e4c0c954","tree":"1781bdd13482bba1ace2d93c6b343f5bf5fae7f8","v":1,"via":"run"}
Ci-Attestation: {"at":1793119525,"gate":"rust/x86_64-unknown-linux-gnu/test","host":"linux-x86_64","key":"45ffcb11a4c69ee4fb8de46b4d314d5d4271e97e8a7555bbdf1a23e1572a234e","lane":"rust-test","parents":["b1eff2d60b0c233caf75d06ff2c75d76d35b2f44"],"secs":217,"stamp":"57fb2333b7c2b57f1c17a6966f1824cb","tree":"1781bdd13482bba1ace2d93c6b343f5bf5fae7f8","v":1,"via":"run"}
Ci-Attestation: {"at":1793119525,"gate":"rust/x86_64-pc-windows-msvc/clippy","host":"linux-x86_64","key":"a5dbd80ed07189bdb58b9aa2f5c76537501e44be147c4f5b449861a01de660f7","lane":"cross","parents":["b1eff2d60b0c233caf75d06ff2c75d76d35b2f44"],"secs":82,"stamp":"726529b19feb277258756d46d6321a45","tree":"1781bdd13482bba1ace2d93c6b343f5bf5fae7f8","v":1,"via":"run"}
Ci-Attestation: {"at":1793119525,"gate":"rust/x86_64-pc-windows-msvc/dylint","host":"linux-x86_64","key":"a5dbd80ed07189bdb58b9aa2f5c76537501e44be147c4f5b449861a01de660f7","lane":"cross","parents":["b1eff2d60b0c233caf75d06ff2c75d76d35b2f44"],"secs":82,"stamp":"0e111144496ee57d10cbcf8552d9d453","tree":"1781bdd13482bba1ace2d93c6b343f5bf5fae7f8","v":1,"via":"run"}
Ci-Attestation: {"at":1793119525,"gate":"rust/aarch64-apple-darwin/clippy","host":"linux-x86_64","key":"a5dbd80ed07189bdb58b9aa2f5c76537501e44be147c4f5b449861a01de660f7","lane":"cross","parents":["b1eff2d60b0c233caf75d06ff2c75d76d35b2f44"],"secs":82,"stamp":"55cf4c0d6c52a4572844dce27f051721","tree":"1781bdd13482bba1ace2d93c6b343f5bf5fae7f8","v":1,"via":"run"}
Ci-Attestation: {"at":1793119525,"gate":"rust/aarch64-apple-darwin/dylint","host":"linux-x86_64","key":"a5dbd80ed07189bdb58b9aa2f5c76537501e44be147c4f5b449861a01de660f7","lane":"cross","parents":["b1eff2d60b0c233caf75d06ff2c75d76d35b2f44"],"secs":82,"stamp":"34ae8fa379ae5761ac8c07391d0d4ca7","tree":"1781bdd13482bba1ace2d93c6b343f5bf5fae7f8","v":1,"via":"run"}
Ci-Attestation: {"at":1793119525,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"f07fb7478335ca7de18abdfaad6130439f5f75b149977cf0d547e5a16931cb3e","lane":"tier2-linux","parents":["b1eff2d60b0c233caf75d06ff2c75d76d35b2f44"],"secs":2034,"stamp":"492f336248dbc0fe482f1892fa955825","tree":"1781bdd13482bba1ace2d93c6b343f5bf5fae7f8","v":1,"via":"run"}
@rdoupe
rdoupe requested a review from zackees as a code owner October 27, 2026 16:46
@rdoupe
rdoupe added this pull request to the merge queue Oct 27, 2026
@rdoupe

rdoupe commented Oct 27, 2026

Copy link
Copy Markdown
Collaborator Author

Handed off to the coordinator

@zackees zackees left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: verified RED → GREEN independently

Checked out the PR head (de8ac3ec5) in a clean worktree and reproduced both sides on this host (soldr's mingw-w64-gcc-15.3.0 cross toolchain, GCC 15.3.0):

RED — with the two -Wno-float-conversion lines removed from rust/obs-c-oracle/build.rs, uv run --no-project ci/test_oracle_mingw.py fails exactly as #2648 reports:

libobs/media-io/audio-math.h:38:25: error: conversion from 'double' to 'float' may change value [-Werror=float-conversion]
   38 |         return isfinite((double)db) ? powf(10.0f, db / 20.0f) : 0.0f;
cc1: all warnings being treated as errors
FAILED (failures=1)

GREEN — with the PR applied, the same test passes, and it is a real pin rather than a tautology: oracle_flags() re-derives the flag list from build.rs (STRICT_FLAGS + the if windows_gnu block) instead of hard-coding it, so dropping the suppression from build.rs fails the test. The skip path (no cross GCC) is correct for hosts without the toolchain.

Gates run on the head:

  • uv run --no-project ci/test_oracle_mingw.py — OK
  • uv run --no-project ci/test_uv_run.py — OK (shebang is #!/usr/bin/env -S uv run --script)
  • ruff check --config ruff.toml ci/test_oracle_mingw.py — clean
  • uv run --no-project -m unittest discover -s ci -p 'test_*.py' — 1597 tests, OK (9 skipped)

No docs/features.md line is needed: build configuration only, no user-visible behaviour change. The PR is CLEAN with every check completed and none failed.

One non-blocking note. -Wno-float-conversion is added to the whole oracle compile for x86_64-pc-windows-gnu, not just audio_math.c, so it relaxes the #516 ratchet for every windows-gnu oracle translation unit — the ratchet's own rule is explicit casts in libobs/** and no -Wno-*. The rationale here is defensible (the warning is a MinGW type-generic-macro false positive from a public header, and the (double) cast is deliberate), so I am not blocking on it, but please either say in the commit/PR that this is the accepted scope for windows-gnu or narrow it if cc-rs offers a per-file hook. Leaving the final call on that to the author/maintainer.

@rdoupe

rdoupe commented Oct 27, 2026

Copy link
Copy Markdown
Collaborator Author

Thanks for checking RED and GREEN yourself.

On the scope note: the windows-gnu oracle compile keeps -Wno-float-conversion for the whole build, and that is the scope I am accepting here. I looked at narrowing it, and it would not narrow much. audio-math.h comes in through libobs/build/libobs.pch.h, the libobs precompiled header that most of the oracle files include, so nearly every windows-gnu file would still need the flag. cc-rs also has no per-file flags; the only way would be a second cc::Build with its own copy of the flag list. The rest of -Wconversion stays on for windows-gnu, and Linux GCC, clang and macOS keep -Wfloat-conversion everywhere, so a real float narrowing in shared code is still caught on every other target. The build.rs comment names #2648, so the exemption comes out once the header no longer needs it (for example isfinite(db) in audio-math.h, which is a public-header change for the maintainer to decide).

The PR is already in the merge queue, so I have not pushed anything for this.

Merged via the queue into master with commit 4cfe670 Oct 27, 2026
34 checks passed
@rdoupe
rdoupe deleted the fix/2648-bug-obs-c-oracle-windows-gnu-ora branch October 27, 2026 17:29
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.

bug: obs-c-oracle: windows-gnu oracle build fails under -Wconversion in audio-math.h

2 participants