Skip to content

build(obs-outputs): make the conversions explicit (#2625) - #2872

Merged
zackees merged 2 commits into
masterfrom
infra/2625-conversion-obs-outputs
Oct 29, 2026
Merged

zackees merged 2 commits into
masterfrom
infra/2625-conversion-obs-outputs

Conversation

@zackees

@zackees zackees commented Oct 29, 2026

Copy link
Copy Markdown
Member

Slice of #2625 (the obs-outputs target). Refs #2625, does not close it.

RED 51c8083a5 turns the three conversion groups on for obs-outputs
instead of inheriting the global -Wno-conversion, -Wno-sign-conversion
and -Wno-float-conversion. The replay of the target's 18 Tier 2 units
(uv run ci/warning_findings.py over the tree's compile database) reports
436 findings:

directory findings units options
plugins/obs-outputs (own sources) 110 10 -Wsign-conversion 90, -Wconversion 20
plugins/obs-outputs/librtmp (vendored) 326 5 -Wsign-conversion 212, -Wconversion 114

librtmp stays exempt, exactly as it already is for -Wcast-qual,
-Wshadow and -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 c885d1826 states the 110 conversions at their boundaries: the
target's own files replay clean with the three groups on, and a real
cmake --build build --target obs-outputs builds the module with zero
warnings and zero errors.

Per file:

  • flv-mux.c.h — pointer differences that are written or returned are
    size_t; the 13-byte FLV header fits the uint32_t start position; the
    24-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 the
    uint8_t the metadata builder packs; start_dts_offset narrows to the
    int32_t FLV timestamps already carry.
  • mp4-mux.c.h — box starts stay int64_t like serializer_get_pos, so the
    differences are not narrowed; offsets and sizes are cast to the widths of
    the fields they are stored in; rl32/rl16 shift a uint32_t so a 0xFF
    byte no longer overflows int; the elst delay keeps its non-negative
    composition offset.
  • mp4-output.c.h — max_size is built as size_t and compared in
    int64_t; the extension offset is a size_t difference.
  • rtmp-av1.c.h, rtmp-hevc.c.h — the bit-reader helpers take and return
    the widths their callers store (int index, unsigned for get_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 the
    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 (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 stay
until every target is ratcheted.

No docs/features.md line: build tooling only.

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 zackees left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

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 feed fwrite/*size are now size_t; the FLV header offset (uint32_t)serializer_get_pos() is bounded by the 13-byte header written just above it; the 24-bit signed ct_offset_ms and the packed flag bytes keep the same bit pattern as the old implicit conversions.
  • mp4-mux.c.h: box starts move to int64_t where they hold serializer_get_pos; rl32 shifts through uint32_t, which removes the int overflow on 0xFF << 24 (rl16 casts the sum the same way); (uint16_t)(... ? -2 : 0) preserves the MOV compression-ID bit pattern; the elst dts_offset/llabs arguments were already converted to uint64_t by util_mul_div64's parameter, so the explicit cast is behaviour-neutral.
  • mp4-output.c.h: max_size becomes size_t and the compare is done in int64_t, so a negative setting behaves as before; extstart is a positive size_t difference.
  • 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's index from unsigned back to int, get_bits_count's bits_left) match the struct fields the expressions already used. rb32's per-byte uint32_t casts fix real signed-shift UB without changing the value.
  • net-if*: getnameinfo's result is now int as the API returns; memset's length is the already-checked positive addr_len.
  • utils.h: clz32/ctz32 take the uint32_t the callers pass, and __builtin_clz truncates to unsigned int anyway.

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.

@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 29, 2026
@zackees
zackees added this pull request to the merge queue Oct 29, 2026
@zackees

zackees commented Oct 29, 2026

Copy link
Copy Markdown
Member Author

Handed off to the coordinator — CI Gate ✅ on the PR, queued in the merge queue; local ./lint --fix is clean and ninja obs-outputs builds the module with no warning.

@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 29, 2026
@zackees
zackees added this pull request to the merge queue Oct 29, 2026
@zackees

zackees commented Oct 29, 2026

Copy link
Copy Markdown
Member Author

The merge-group run 40832333776 failed in Build 🧱 / Rust Tier 2 (macos-26) on libobs-opengl/gl-stagesurf.c.h:144 (GLint -> GLuint, -Wsign-conversion). That file is not in this PR's diff (plugins/obs-outputs only): it is master's macOS red from #2871, whose conversion replay ran on Linux and never compiled device_stage_texture()'s #ifdef __APPLE__ body.

Filed as P0 #2879 with the fix PR #2880 ((GLuint)last_fbo + (GLsizei) on the glReadPixels dimensions). No change needed on this branch; re-queue once #2880 lands.

@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 29, 2026
@zackees
zackees added this pull request to the merge queue Oct 29, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 29, 2026
@zackees
zackees added this pull request to the merge queue Oct 29, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 29, 2026
@zackees
zackees added this pull request to the merge queue Oct 29, 2026
@obs-rust-project-manager obs-rust-project-manager Bot moved this to In merge queue in obs-rust Multiview Oct 29, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 29, 2026
@zackees
zackees added this pull request to the merge queue Oct 29, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 29, 2026
@zackees
zackees added this pull request to the merge queue Oct 29, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 29, 2026
@zackees
zackees added this pull request to the merge queue Oct 29, 2026
@zackees

zackees commented Oct 29, 2026

Copy link
Copy Markdown
Member Author

The queue entry went UNMERGEABLE on two merge-group runs (40846375440, 40848369209). Both failed in Build 🧱 / Rust Tier 2 (macos-26), and not in this PR's files:

libobs/obs-cocoa.m.h:161:23: error: implicit conversion changes signedness: 'CFIndex' (aka 'long') to 'size_t'
libobs/obs-cocoa.m.h:727:26: error: implicit conversion changes signedness: 'unsigned int' to 'int'
libobs/obs-cocoa.m.h:836:53: error: implicit conversion loses integer precision: 'int' to 'UInt16'
libobs/obs-cocoa.m.h:861:75: error: implicit conversion changes signedness: 'UniCharCount' ... to 'CFIndex'

That is master's own macOS redness (#2879), not obs-outputs: this PR selects the macOS lane, whose libobs build stops on the unfixed Cocoa conversions. It is fixed by #2892 (draft, libobs/obs-cocoa.m.h among its files) and the follow-on wave by #2897.

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.

@zackees

zackees commented Oct 29, 2026

Copy link
Copy Markdown
Member Author

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:

  • 40848369209 and 40846375440: Rust Tier 2 (macos-26) failed at libobs/obs-cocoa.m.h:161, :727, :836, :861 (-Werror,-Wsign-conversion, -Wimplicit-int-conversion). This branch changes plugins/obs-outputs only, so the failure is master's, not yours.

An UNMERGEABLE entry holds every PR behind it, so it comes out until master is green: #2892 (draft) is the fix for those four sites, and #2896 has the next wave of enum → int seam sites claimed. I will re-queue this PR as soon as master's macOS Tier 2 lane passes — no rebase is needed for it, and its own PR CI is green at c885d1826 (11 successes, no failures).

Nothing for the author to do here.

@zackees
zackees removed this pull request from the merge queue due to a manual request Oct 29, 2026
@zackees
zackees added this pull request to the merge queue Oct 29, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 29, 2026
@zackees
zackees added this pull request to the merge queue Oct 29, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 29, 2026
@zackees
zackees added this pull request to the merge queue Oct 29, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 29, 2026
@zackees
zackees added this pull request to the merge queue Oct 29, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 29, 2026
@zackees
zackees added this pull request to the merge queue Oct 29, 2026
Merged via the queue into master with commit f907d09 Oct 29, 2026
34 checks passed
@zackees
zackees deleted the infra/2625-conversion-obs-outputs branch October 29, 2026 12:22
zackees added a commit that referenced this pull request Oct 29, 2026
…#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.
@obs-rust-project-manager obs-rust-project-manager Bot moved this from In merge queue to Done in obs-rust Multiview Oct 29, 2026
MCPVOT pushed a commit to MCPVOT/obs-studio that referenced this pull request Oct 30, 2026
… 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)
MCPVOT pushed a commit to MCPVOT/obs-studio that referenced this pull request Oct 30, 2026
…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
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.

1 participant