Repository navigation
Conversation
zackees
left a comment
There was a problem hiding this comment.
Reviewed — correct, and the four sites are exactly the ones the macOS job reported.
dstr_reserve(str, (size_t) max_size):CFStringGetMaximumSizeForEncoding()returnsCFIndex; theassert(max_size > 0)immediately above is the in-range proof thesize_tconversion needs. Value unchanged.int button = (int) key - 1: narrowing the enum before the subtraction keeps the old unsigned-shaped result for the values that reach it, and the enclosingOBS_KEY_MOUSE1..OBS_KEY_MOUSE29guard boundsbuttonto 0..28, so1 << buttonstays insideint.(UInt16) ((alphaLock >> 8) & 0xFF): the mask already bounds the value, the cast only states it forUCKeyTranslate().(CFIndex) length:lengthis whatUCKeyTranslate()wrote, bounded bymaxLength(16).
Style matches the C-style boundary casts already on master (libobs-opengl #2880), and there is no -Wno-*, no #pragma, and no change to the ratchet pin.
RED is master's Build 🧱 / Rust Tier 2 (macos-26) job 123326083017; the GREEN check is this PR's own macOS lane, which has not run yet (Fast Gate is still pending). Not queueing until it does.
|
Validation note: this PR is the macOS-only TU the Linux replay cannot see, so its own |
…ts (#2625) #2877 enabled -Wsign-conversion on the libobs targets but could only replay the Linux translation units. AppleClang reaches obs-cocoa.m.h, and the first run after the merge failed there with four conversion diagnostics. State each at its boundary: the CFIndex that the assert proves positive, the enum subtraction that is unsigned until it is narrowed, the int key-action that fits UInt16, and the UniCharCount handed to a CFIndex parameter.
6201e93 to
50628d6
Compare
|
This is now master breakage, not just a lane finding: the merge group for #2872 ( One more diagnostic than the first head fixed: |
-RED: `Rust Tier 2 (macos-26)` on `07340d52e` + #2887's cocoa fix (job 123343547757) reports 19 `-Werror,-Wsign-conversion` / `-Wimplicit-int-conversion` diagnostics in the four Rust seam call sites below: `enum video_format`, `obs_bounds_type`, `obs_scale_type`, `obs_blending_method`, `obs_blending_type`, `gs_color_space` and `obs_deinterlace_mode` passed to a helper the port declares with an `int` parameter. AppleClang gives an all-non-negative enum an unsigned underlying type; GCC and Linux clang keep `int`, so #2877's replay of the same TUs could not see them. -GREEN: state the conversion at each call site, leaving the seam signatures and the Rust `c_int` ABI unchanged. Two further sites of the same class (obs_canvas_draw_technique()/reads_white_level() in obs.c.h, the deinterlace mode-change call) are cast with them so the next macOS wave does not re-report the group. No Rust or cmocka change: no signature moved, and the casts are behaviour-neutral (the values are enum members, not sentinels).
|
Superseded by #2897, which carries this commit plus the enum -> int seam wave (#2896) in one PR. The two are the same macOS |
|
The cocoa fix works — the lane now gets past
They are all the enum-to- |
-RED: `Rust Tier 2 (macos-26)` on `07340d52e` + #2887's cocoa fix (job 123343547757) reports 19 `-Werror,-Wsign-conversion` / `-Wimplicit-int-conversion` diagnostics in the four Rust seam call sites below: `enum video_format`, `obs_bounds_type`, `obs_scale_type`, `obs_blending_method`, `obs_blending_type`, `gs_color_space` and `obs_deinterlace_mode` passed to a helper the port declares with an `int` parameter. AppleClang gives an all-non-negative enum an unsigned underlying type; GCC and Linux clang keep `int`, so #2877's replay of the same TUs could not see them. -GREEN: state the conversion at each call site, leaving the seam signatures and the Rust `c_int` ABI unchanged. Two further sites of the same class (obs_canvas_draw_technique()/reads_white_level() in obs.c.h, the deinterlace mode-change call) are cast with them so the next macOS wave does not re-report the group. No Rust or cmocka change: no signature moved, and the casts are behaviour-neutral (the values are enum members, not sentinels).
-RED: `Rust Tier 2 (macos-26)` on `07340d52e` + #2887's cocoa fix (job 123343547757) reports 19 `-Werror,-Wsign-conversion` / `-Wimplicit-int-conversion` diagnostics in the four Rust seam call sites below: `enum video_format`, `obs_bounds_type`, `obs_scale_type`, `obs_blending_method`, `obs_blending_type`, `gs_color_space` and `obs_deinterlace_mode` passed to a helper the port declares with an `int` parameter. AppleClang gives an all-non-negative enum an unsigned underlying type; GCC and Linux clang keep `int`, so #2877's replay of the same TUs could not see them. -GREEN: state the conversion at each call site, leaving the seam signatures and the Rust `c_int` ABI unchanged. Two further sites of the same class (obs_canvas_draw_technique()/reads_white_level() in obs.c.h, the deinterlace mode-change call) are cast with them so the next macOS wave does not re-report the group. No Rust or cmocka change: no signature moved, and the casts are behaviour-neutral (the values are enum members, not sentinels).
-RED: `Rust Tier 2 (macos-26)` on `07340d52e` + #2887's cocoa fix (job 123343547757) reports 19 `-Werror,-Wsign-conversion` / `-Wimplicit-int-conversion` diagnostics in the four Rust seam call sites below: `enum video_format`, `obs_bounds_type`, `obs_scale_type`, `obs_blending_method`, `obs_blending_type`, `gs_color_space` and `obs_deinterlace_mode` passed to a helper the port declares with an `int` parameter. AppleClang gives an all-non-negative enum an unsigned underlying type; GCC and Linux clang keep `int`, so #2877's replay of the same TUs could not see them. -GREEN: state the conversion at each call site, leaving the seam signatures and the Rust `c_int` ABI unchanged. Two further sites of the same class (obs_canvas_draw_technique()/reads_white_level() in obs.c.h, the deinterlace mode-change call) are cast with them so the next macOS wave does not re-report the group. No Rust or cmocka change: no signature moved, and the casts are behaviour-neutral (the values are enum members, not sentinels).
-RED: `Rust Tier 2 (macos-26)` on `07340d52e` + #2887's cocoa fix (job 123343547757) reports 19 `-Werror,-Wsign-conversion` / `-Wimplicit-int-conversion` diagnostics in the four Rust seam call sites below: `enum video_format`, `obs_bounds_type`, `obs_scale_type`, `obs_blending_method`, `obs_blending_type`, `gs_color_space` and `obs_deinterlace_mode` passed to a helper the port declares with an `int` parameter. AppleClang gives an all-non-negative enum an unsigned underlying type; GCC and Linux clang keep `int`, so #2877's replay of the same TUs could not see them. -GREEN: state the conversion at each call site, leaving the seam signatures and the Rust `c_int` ABI unchanged. Two further sites of the same class (obs_canvas_draw_technique()/reads_white_level() in obs.c.h, the deinterlace mode-change call) are cast with them so the next macOS wave does not re-report the group. No Rust or cmocka change: no signature moved, and the casts are behaviour-neutral (the values are enum members, not sentinels).
…#2879) (obs-rust#2900) * libobs-opengl: state the macOS Cocoa conversions too (obs-rust#2879) The first green attempt still failed: the same #ifdef-only blind spot hides four more -Wsign-conversion diagnostics (CGLTexImageIOSurface2D takes GLsizei widths from uint32_t texture fields) and two -Wfloat-conversion ones (CGSize CGFloat dimensions into device_texture_create's uint32_t). State them at the call; values unchanged. * libobs: state the four macOS Cocoa conversions too (obs-rust#2879) The libobs ratchet (obs-rust#2877) had the same Linux-only replay blind spot: the macOS Tier 2 lane then reported CFIndex -> size_t (dstr_reserve), obs_key_t -> int (mouse button index), int -> UInt16 (UCKeyTranslate key code) and UniCharCount -> CFIndex (CFStringCreateWithCharactersNoCopy). State each at the call; values unchanged. * libobs: state the CoreAudio device-name length conversion (obs-rust#2879) -Wsign-conversion on the macOS Tier 2 lane rejects strlen()'s size_t as the CFIndex byte count; cast at the boundary. * build(libobs): state the enum -> int seam conversions (obs-rust#2896) -RED: `Rust Tier 2 (macos-26)` on `07340d52e` + obs-rust#2887's cocoa fix (job 123343547757) reports 19 `-Werror,-Wsign-conversion` / `-Wimplicit-int-conversion` diagnostics in the four Rust seam call sites below: `enum video_format`, `obs_bounds_type`, `obs_scale_type`, `obs_blending_method`, `obs_blending_type`, `gs_color_space` and `obs_deinterlace_mode` passed to a helper the port declares with an `int` parameter. AppleClang gives an all-non-negative enum an unsigned underlying type; GCC and Linux clang keep `int`, so obs-rust#2877's replay of the same TUs could not see them. -GREEN: state the conversion at each call site, leaving the seam signatures and the Rust `c_int` ABI unchanged. Two further sites of the same class (obs_canvas_draw_technique()/reads_white_level() in obs.c.h, the deinterlace mode-change call) are cast with them so the next macOS wave does not re-report the group. No Rust or cmocka change: no signature moved, and the casts are behaviour-neutral (the values are enum members, not sentinels). * build(libobs): state the source render-plan conversions (obs-rust#2896) The next macOS Tier 2 wave after b43279b reports 19 more 'enum -> int' conversions, all in libobs/obs-source.c.h: the monitoring type fed to obs_source_audio_place_outputs(), the async and sync render plans' gs_color_space arguments, and src->format into obs_source_frame_copy_plan(). AppleClang gives all-positive enums an unsigned underlying type; the seam helpers take int (the Rust c_int ABI carries -1 sentinels), so each call site is an implicit conversion visible only on Apple platforms. Cast at each call site; signatures, Rust ABI and tests do not move. * build(frontend): enable the sign-conversion warnings on the app target (obs-rust#2625) * frontend: state the sign conversions the app target now reports (obs-rust#2625) * build(libobs): state the source frame-copy seam conversions (obs-rust#2879) -Wsign-conversion on the macOS lane rejects enum video_format and enum video_range_type as the int parameters of the frame-copy helpers, whose signatures are public API (obs-source-frame-copy.h) and stay int. State the conversion at each of the seven call sites in obs-source.c.h. * build(libobs): state the output and video conversions the macOS lane reports (obs-rust#2879) The macOS Tier 2 lane on this branch stopped on the next wave after the obs-source frame-copy seams: encoder-type slots, the CoreAudio caption shift, the video copy-plan keys and the GPU encode format gate. Explicit casts only; same values the compiler converted implicitly. * build(libobs): state the hotkey name-map key conversion (obs-rust#2879) * build(libobs): state the macOS path and CFString size conversions (obs-rust#2879) * build(libobs): apply the local formatter to the platform-cocoa casts
The
libobsconversion ratchet (#2877, merged asee3273d6) put-Wsign-conversionon the libobs targets for every Clang/GNU platform. Linux was replayed and clean, but AppleClang reaches the macOS-onlylibobs/obs-cocoa.m.htranslation unit, and the first PR run after the merge failed on it (job 123326083017,Build 🧱 / Rust Tier 2 (macos-26)):Each conversion is now stated at its boundary, and the value each site had is kept:
dstr_reserve(&str, max_size)—CFStringGetMaximumSizeForEncoding()returnsCFIndex; theassert(max_size > 0)above it is the proof that thesize_tconversion is in range.int button = key - 1—obs_key_t's compatible type isunsigned int, so the subtraction was unsigned; the enum value is narrowed first, and the enclosingOBS_KEY_MOUSE1..OBS_KEY_MOUSE29range bounds it.UCKeyTranslate()calls —((alphaLock >> 8) & 0xFF)isintand fits theUInt16key-action parameter exactly.CFStringCreateWithCharactersNoCopy(NULL, buffer, length, …)—lengthis theUniCharCountthatUCKeyTranslate()just wrote, bounded by themaxLengthof 16.No
-Wno-*, no#pragma, no change to the pin. This is the macOS half of the same class the Linux replay of #2877 could not see; the run above is the RED evidence, and this PR's own macOS lane is the GREEN check.Refs #2625