Repository navigation
build(obs-outputs): make the conversions explicit (#2625) - #2872
Conversation
RED: the target now compiles with -Wconversion, -Wsign-conversion and -Wfloat-conversion instead of inheriting the global -Wno-* pins. The replay of its 18 Tier 2 units reports 436 diagnostics: 326 in the vendored librtmp sources (which stay exempt, as they are for -Wcast-qual, -Wshadow and -Wpedantic) and 110 in 10 of the target's own files (-Wsign-conversion 90, -Wconversion 20).
GREEN: the 110 diagnostics the RED commit exposed are stated at their boundaries and the target's 10 own files replay clean with the three groups on; a real `ninja obs-outputs` builds the module with no warning. - flv-mux: the pointer differences that are written or returned are size_t; the 13-byte FLV header fits the uint32 start position; the 24-bit signed offsets and the packed header flag bytes are cast where they are packed. - flv-output/rtmp-stream: the primaries enum goes to the uint8_t the metadata builder packs. - mp4-mux: box starts stay int64_t like serializer_get_pos, so the differences are not narrowed; box offsets and sizes are explicitly cast to the field widths they are stored in; rl32/rl16 shift on a uint32_t so the 0xFF byte does not overflow int; the elst delay keeps its non-negative composition offset. - mp4-output: max_size is built as size_t and compared in int64_t, and the extension offset is a size_t difference. - rtmp-av1/rtmp-hevc: the bit-reader helpers take and return the widths their callers store (int index, unsigned for get_bits), and the NAL and buffer lengths are cast where the buffer APIs take int/size_t. - net-if: memset's length is a checked-positive int; getnameinfo's result is an int, as the API returns. - utils.h: clz32/ctz32 take the uint32_t both callers pass, matching the portable popcnt fallback; __builtin_clz already truncates its argument to unsigned int, so the value is unchanged. No behaviour change: every cast keeps the value the code already computed. The global -Wno-conversion / -Wno-sign-conversion / -Wno-float-conversion stay until every target is ratcheted.
zackees
left a comment
There was a problem hiding this comment.
Coordinator review — read the whole diff and the two commits (51c8083a5 RED, c885d1826 GREEN).
Verdict: correct as a conversion-warning ratchet, no blocking findings.
Build wiring. The target gets -Wconversion;-Wsign-conversion;-Wfloat-conversion instead of inheriting the global pins, and librtmp keeps them off through the existing per-source COMPILE_OPTIONS (-Wno-conversion;-Wno-sign-conversion added there). That matches the vendored-not-ported treatment already used for -Wcast-qual/-Wshadow/-Wpedantic, and -Wno-conversion also covers -Wfloat-conversion for the vendored tree. The global pins stay, so no other target changes behaviour.
Casts. I checked each one against the value it carries:
flv-mux.c.h: pointer differences that feedfwrite/*sizeare nowsize_t; the FLV header offset(uint32_t)serializer_get_pos()is bounded by the 13-byte header written just above it; the 24-bit signedct_offset_msand the packed flag bytes keep the same bit pattern as the old implicit conversions.mp4-mux.c.h: box starts move toint64_twhere they holdserializer_get_pos;rl32shifts throughuint32_t, which removes theintoverflow on0xFF << 24(rl16casts the sum the same way);(uint16_t)(... ? -2 : 0)preserves the MOV compression-ID bit pattern; theelstdts_offset/llabsarguments were already converted touint64_tbyutil_mul_div64's parameter, so the explicit cast is behaviour-neutral.mp4-output.c.h:max_sizebecomessize_tand the compare is done inint64_t, so a negative setting behaves as before;extstartis a positivesize_tdifference.rtmp-av1.c.h/rtmp-hevc.c.h: the widened-int casts are all on small bit-reader results; the two type changes (get_bit1'sindexfromunsignedback toint,get_bits_count'sbits_left) match the struct fields the expressions already used.rb32's per-byteuint32_tcasts fix real signed-shift UB without changing the value.net-if*:getnameinfo's result is nowintas the API returns;memset's length is the already-checked positiveaddr_len.utils.h:clz32/ctz32take theuint32_tthe callers pass, and__builtin_clztruncates tounsigned intanyway.
Tiers. Build-tooling only: no behaviour, no public API, no user-visible change, so no Tier 2/3 lane and no docs/features.md line (the body says so). The PR CI gate is green: 34 passed, 0 failed, 0 running, and the macOS/Windows lanes are skipped by the LANES table for this path.
No fixup pushed. Queueing it now.
|
Handed off to the coordinator — CI Gate ✅ on the PR, queued in the merge queue; local |
|
The merge-group run 40832333776 failed in Filed as P0 #2879 with the fix PR #2880 ( |
|
The queue entry went That is master's own macOS redness (#2879), not So this waits on #2892 landing, not on any change here. Leaving the branch as it is; it will be rebased and re-queued once #2892 is in master. |
|
Removed from the merge queue (coordinator, 2026-10-29) — not for anything in this diff. The merge group failed twice, both on the same macOS-only diagnostics that master carries and this PR does not touch:
An Nothing for the author to do here. |
…#2921) The four diagnostics the macOS lanes report (scheduled run 40825610950, dispatch run 40879828636) are stated at their call sites. gcc's -Wconversion reports none of them, which is why #2872's ratchet landed green on the Linux replay; AppleClang adds -Wimplicit-int-conversion and -Wimplicit-int-conversion-on-negation. Behaviour is unchanged: the old and new expressions agree over 200,000 pseudo-random inputs for rl32, the colour-range byte and the roll distance, and roll(3) still writes 0xFFFD.
… clang reports (obs-rust#2921) (obs-rust#2922) * build(obs-outputs): state the mp4-mux conversions macOS clang reports (obs-rust#2921) The four diagnostics the macOS lanes report (scheduled run 40825610950, dispatch run 40879828636) are stated at their call sites. gcc's -Wconversion reports none of them, which is why obs-rust#2872's ratchet landed green on the Linux replay; AppleClang adds -Wimplicit-int-conversion and -Wimplicit-int-conversion-on-negation. Behaviour is unchanged: the old and new expressions agree over 200,000 pseudo-random inputs for rl32, the colour-range byte and the roll distance, and roll(3) still writes 0xFFFD. * build(obs-outputs): state the rtmp-hevc conversions macOS clang reports (obs-rust#2921) * build(obs-outputs): state the mp4-output flags conversion macOS clang reports (obs-rust#2921)
…t#2946) (obs-rust#2947) `qt_platform::translate_modifiers()` accumulates `INTERACT_*` flags in an `int` and returns them as `uint32_t`. AppleClang's `-Wsign-conversion` (part of the conversion ratchet obs-rust#2872 added for obs-rust#2625) rejects the return on both macOS app builds and the clang-analyze lane: qt-host-macos.cpp.hpp:43:9: error: implicit conversion changes signedness: 'int' to 'uint32_t' (aka 'unsigned int') [-Werror,-Wsign-conversion] return obsModifiers; The statement is the one the POSIX sibling already carries (`qt-host-posix.cpp.hpp:47`, `5298ad7ec` for obs-rust#2900): the local stays `int`, the return states the widening. Every `INTERACT_*` flag is a non-negative constant, so the returned value is unchanged - all 16 modifier combinations return the same value with and without the cast. RED: a reduced translation unit with this function's return compiled under `-Wconversion -Wsign-conversion -Werror` stops on the diagnostic above. GREEN: the same unit with `static_cast<uint32_t>` compiles, and the run agrees on all 16 combinations. Refs obs-rust#2946
Slice of #2625 (the
obs-outputstarget). Refs #2625, does not close it.RED
51c8083a5turns the three conversion groups on forobs-outputsinstead of inheriting the global
-Wno-conversion,-Wno-sign-conversionand
-Wno-float-conversion. The replay of the target's 18 Tier 2 units(
uv run ci/warning_findings.pyover the tree's compile database) reports436 findings:
plugins/obs-outputs(own sources)-Wsign-conversion90,-Wconversion20plugins/obs-outputs/librtmp(vendored)-Wsign-conversion212,-Wconversion114librtmpstays exempt, exactly as it already is for-Wcast-qual,-Wshadowand-Wpedantic: it is vendored C89 that this port does not edit.The exemption is added to the existing per-source option list in the same
commit, so the 326 are out of scope here; every other source in the target is
covered.
GREEN
c885d1826states the 110 conversions at their boundaries: thetarget's own files replay clean with the three groups on, and a real
cmake --build build --target obs-outputsbuilds the module with zerowarnings and zero errors.
Per file:
flv-mux.c.h— pointer differences that are written or returned aresize_t; the 13-byte FLV header fits theuint32_tstart position; the24-bit signed offsets and packed header flag bytes are cast where packed.
flv-output.c.h,rtmp-stream.c.h— the primaries enum goes to theuint8_tthe metadata builder packs;start_dts_offsetnarrows to theint32_tFLV timestamps already carry.mp4-mux.c.h— box starts stayint64_tlikeserializer_get_pos, so thedifferences are not narrowed; offsets and sizes are cast to the widths of
the fields they are stored in;
rl32/rl16shift auint32_tso a0xFFbyte no longer overflows
int; theelstdelay keeps its non-negativecomposition offset.
mp4-output.c.h—max_sizeis built assize_tand compared inint64_t; the extension offset is asize_tdifference.rtmp-av1.c.h,rtmp-hevc.c.h— the bit-reader helpers take and returnthe widths their callers store (
intindex,unsignedforget_bits),and NAL/buffer lengths are cast where the buffer APIs take
int/size_t.net-if.c.h,net-if-host-posix.c.h—memset's length is thechecked-positive
int;getnameinfo's result is anint, as the APIreturns.
utils.h—clz32/ctz32take theuint32_tboth callers pass, matchingthe portable
popcntfallback.__builtin_clzalready truncates itsargument to
unsigned int(checked with GCC 15:clz32((unsigned long)1)is 31), so no value changes.
No behaviour change: every cast keeps the value the code already computed, and
no narrowing cast is used where the range is not already enforced. No pragmas
and no per-file
-Wno-*were added for our own sources. The global pins stayuntil every target is ratcheted.
No
docs/features.mdline: build tooling only.