Skip to content

build(image-source): compile the plugin's targets with the conversion warnings enabled (#2625) - #2753

Merged
zackees merged 2 commits into
masterfrom
infra/2625-conversion-image-source
Oct 28, 2026
Merged

zackees merged 2 commits into
masterfrom
infra/2625-conversion-image-source

Conversation

@zackees

@zackees zackees commented Oct 28, 2026

Copy link
Copy Markdown
Member

Slice of #2625 (drop the conversion pins). One target, as the issue's
acceptance criteria require: the pins cannot be deleted per directory.

RED — 970c73a0a

plugins/image-source/CMakeLists.txt enables -Wconversion,
-Wsign-conversion and -Wfloat-conversion on the image-source target only
(C sources). Replaying the target's Tier 2 unity translation units from the
build tree's compile database with the three -Wno-* pins dropped and the
groups enabled reports nine diagnostics:

file line conversion
obs-slideshow.c.h 497 size_t index -> long long (calldata_set_int)
obs-slideshow.c.h 889 size_t cur_item -> long long
obs-slideshow.c.h 895 size_t files.num -> long long
obs-slideshow.c.h 1195 pointer difference -> size_t (dstr_resize)
obs-slideshow-mk2.c.h 192 rand() int -> size_t
obs-slideshow-mk2.c.h 251 size_t slide_idx -> long long
obs-slideshow-mk2.c.h 752 size_t slide_idx -> long long
obs-slideshow-mk2.c.h 758 size_t files.num -> long long
obs-slideshow-mk2.c.h 1024 pointer difference -> size_t (dstr_resize)

GREEN — 843148db3

Each conversion is made explicit at the call site and every cast keeps the
value the code already computed: the slideshow indexes and file counts are
bounded by the file array length, rand() is non-negative, and the
dstr_resize length is a strrchr offset inside the dstr's own buffer. The
same replay reports zero diagnostics, rc 0 with -Werror still on.

clang-format --dry-run --Werror clean on both files, gersemi -c clean on
the CMake list, ./lint ok (133 s).

The global -Wno-conversion / -Wno-sign-conversion / -Wno-float-conversion
pins stay in the shared flag lists until every target is ratcheted; the last
slice deletes them.

Refs #2625

… warnings enabled (#2625)

Replaying the target's unity translation units from the Tier 2 compile
database with -Wconversion, -Wsign-conversion and -Wfloat-conversion
reports nine diagnostics: four in obs-slideshow.c.h and five in
obs-slideshow-mk2.c.h.

Refs #2625
Nine -Wsign-conversion diagnostics, all of them a value the code already
computed: the calldata setters take a long long and the slideshow indexes
and file counts are size_t, rand() is non-negative, and the dstr_resize
length is a pointer difference into a buffer that is in bounds.

The same replay of the target's translation units with the three groups
enabled reports zero diagnostics, rc 0 with -Werror still on.

Refs #2625
@zackees

zackees commented Oct 28, 2026

Copy link
Copy Markdown
Member Author

Handed off to the coordinator.

PR CI is green: CI Gate ✅, Format 🔍 / checks, Build 🧱 / Fast Gate ⚡, Build 🧱 / Rust Tier 2 Linux 🐧 (build plus every tests ON/OFF shard) all success. Queued for the merge queue.

Local evidence (in the description): the target's nine -Wsign-conversion diagnostics replay to zero with the three groups enabled and -Werror on; clang-format, gersemi -c and ./lint clean. No local-gate stamp — the change touches one CMake list and two plugin C sources, and nothing on the Rust side.

Merged via the queue into master with commit 7199bb8 Oct 28, 2026
39 checks passed
@zackees
zackees deleted the infra/2625-conversion-image-source branch October 28, 2026 09:15
zackees added a commit that referenced this pull request Oct 28, 2026
… a float (#2625)

#2753 enabled -Wfloat-conversion on the image-source target. GCC does not
flag it, so the slice was green on Linux PR CI, but AppleClang reports it
in the release lane's macOS app build:

  obs-slideshow.c.h:983 implicit conversion turns floating-point number
  into integer: 'float' to 'bool' [-Werror,-Wfloat-conversion]

  if (!ss->transition || !ss->slide_time)

'!x' on a float is 'x == 0.0f' (NaN was already false), so the comparison
is spelled out and the value tested is unchanged. Same verify-only run
40689520273 (arm64 job 122820591980) is the RED evidence.
MCPVOT pushed a commit to MCPVOT/obs-studio that referenced this pull request Oct 30, 2026
… ratchets (obs-rust#2625) (obs-rust#2789)

* fix(text-freetype2): cast the two size_t arguments the macOS/Windows build flags (obs-rust#2625)

obs-rust#2755 enabled -Wconversion/-Wsign-conversion on the text-freetype2 target,
but the Linux lane never compiles find-font.c.h: the nix unity group uses
find-font-unix.c.h, and find-font.c.h is only in the windows+ and macos+
groups. So the ratchet looked clean on Linux while the release lane's
macOS and Windows app builds failed:

  find-font.c.h:58:30: da_resize(font_list, count) - int -> size_t
  find-font.c.h:218:31: da_reserve(sizes, face->num_fixed_sizes) -
                        FT_Int -> size_t

Both casts keep the value the code already passed (the implicit conversion
happened inside da_resize/da_reserve). Red run 40684548610 (arm64 job
122803565099) is the evidence; reproduced locally by adding the find-font
unity group to the Linux target for one build:

  find-font.c.h:58  conversion to size_t from int
  find-font.c.h:218 conversion to size_t from FT_Int
  -> after the casts: neither diagnostic (only the shadow error the
     temporary double include provokes on Linux, absent on the real
     Windows/macOS build).

Refs obs-rust#2625

* fix(image-source): compare the slide time to zero instead of negating a float (obs-rust#2625)

obs-rust#2753 enabled -Wfloat-conversion on the image-source target. GCC does not
flag it, so the slice was green on Linux PR CI, but AppleClang reports it
in the release lane's macOS app build:

  obs-slideshow.c.h:983 implicit conversion turns floating-point number
  into integer: 'float' to 'bool' [-Werror,-Wfloat-conversion]

  if (!ss->transition || !ss->slide_time)

'!x' on a float is 'x == 0.0f' (NaN was already false), so the comparison
is spelled out and the value tested is unchanged. Same verify-only run
40689520273 (arm64 job 122820591980) is the RED evidence.
MCPVOT pushed a commit to MCPVOT/obs-studio that referenced this pull request Oct 30, 2026
…show (obs-rust#2625) (obs-rust#2803)

obs-rust#2753 enabled -Wconversion/-Wsign-conversion/-Wfloat-conversion on the
image-source target. obs-rust#2789 repaired the one finding that the release lane
had reached by then, in obs-slideshow.c.h, but the plugin carries a legacy
twin, obs-slideshow-mk2.c.h, which sits in the *core* unity group and has
the same guard spelled the same way:

  plugins/image-source/obs-slideshow-mk2.c.h:830:31: error: implicit
  conversion turns floating-point number into integer: 'float' to '_Bool'
  [-Werror,-Wfloat-conversion]
      if (!ss->transition || !ssd->slide_time)

GCC does not flag float-to-bool, so the slice was green on Linux PR CI;
AppleClang reports it in the macOS app build, which PR CI never runs.
Red evidence: verify-only dispatch 40699926737 (the dispatch this PR's
branch was opened from), jobs 122858738716 (macos x86_64) and
122858739020 (macos arm64), both stop at that line; the matching Linux
gate job for the same run was green.

'!x' on a float is 'x == 0.0f' (a NaN slide time was already false), so
the comparison is spelled out and the value tested is unchanged. Local
reproduction with clang -Wfloat-conversion, stubbing the two fields:

  before: error: implicit conversion turns floating-point number into
          integer: 'float' to '_Bool' [-Werror,-Wfloat-conversion]
  after:  clean

Refs obs-rust#2625
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