Repository navigation
obs-c-oracle: Allow MinGW isfinite float casts - #2665
Conversation
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"}
|
Handed off to the coordinator |
zackees
left a comment
There was a problem hiding this comment.
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— OKuv 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— cleanuv 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.
|
Thanks for checking RED and GREEN yourself. On the scope note: the windows-gnu oracle compile keeps The PR is already in the merge queue, so I have not pushed anything for this. |
Fixes #2648
What and why
Since
-Wconversionjoined the C oracle'sSTRICT_FLAGS(#2632), thex86_64-pc-windows-gnubuild ofobs-c-oracle(mingw-w64 GCC 15.3.0) stops inaudio-math.h'sdb_to_mul(), so the local gate'srust-testlane fails on master in its windows-gnu--no-runstep:MinGW's
isfinite()is a type-generic macro whosefloatbranch casts its argument tofloat; GCC checks that branch even though adoublenever takes it. glibc'sisfinite()is a builtin, and MSVC doesn't get the flag, so only this target sees it.audio-math.his a public libobs header, so it stays as it is. Insteadrust/obs-c-oracle/build.rsadds-Wno-float-conversionfor the windows-gnu oracle only, with a comment naming this issue. The Linux GCC, clang and macOS builds of the oracle keep the full-Wconversioncheck. No code the oracle compiles changes.No upstream issue.
RED → GREEN
ci/test_oracle_mingw.py, which compilesoracle/audio_math.cwith 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-conversionerror above, and it is the only failure in--lane lint.soldr cargo build -p obs-c-oracle --target x86_64-pc-windows-gnu --lockedfails the same way. This is a focused build configuration fix, so the RED evidence is local and RED and GREEN are pushed together.uv run ci/local_gate.py --lane rust-testpasses: 4665 passed, 6 skipped, then 845 passed, 0 skipped, and the windows-gnu--no-runbuilds every test.--test-diff origin/master: 4390 passed, 6 skipped.--lane lint(with the new test) and--lane crosspass, andsoldr cargo clippy --workspace --target x86_64-pc-windows-msvc --all-targets --locked -- -D warningsis 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.Checklist
master(or the description starts with a Stacked: note)docs/features.mdis added or updated (not applicable: no user-visible change)-W..., ratchets): built with scripting ON (PR CI builds no OBS app: rungh 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)