Skip to content

build(libobs): state the Wayland host conversions the ratchet reports (#2885) - #2889

Merged
zackees merged 1 commit into
masterfrom
fix/2885-wayland-conversions
Oct 29, 2026
Merged

zackees merged 1 commit into
masterfrom
fix/2885-wayland-conversions

Conversation

@zackees

@zackees zackees commented Oct 29, 2026

Copy link
Copy Markdown
Member

Closes #2885

The #2625 ratchet put -Wconversion -Wsign-conversion -Wfloat-conversion (with
-Werror) on the libobs and libobs-opengl targets, but the Wayland host TUs
are not compiled by the PR lanes: they only appear in a build with
ENABLE_WAYLAND=ON. On master they still carry implicit conversions, so a
default Linux app build stops.

RED

ninja libobs libobs-opengl at 07340d52e in a RelWithDebInfo tree configured
with -DENABLE_WAYLAND=ON (the target flags above):

libobs/obs-nix-wayland.c.h:66:97: error: conversion to 'xkb_level_index_t' {aka 'unsigned int'} from 'int' may change the sign of the result [-Werror=sign-conversion]
   66 |  int nsyms = xkb_keymap_key_get_syms_by_level(keymap, key, plat->current_layout, level, &syms);
libobs/obs-nix-wayland.c.h:70:78: error: conversion to 'int' from 'xkb_keysym_t' {aka 'unsigned int'} may change the sign of the result [-Werror=sign-conversion]
   70 |  obs_key_t obs_key = obs_nix_wayland_key_from_virtual_key(syms[0]);
libobs/obs-nix-wayland.c.h:158:101: error: conversion to 'int' from 'xkb_keysym_t' {aka 'unsigned int'} may change the sign of the result [-Werror=sign-conversion]
libobs/obs-nix-portal-shortcuts.c.h:389:35: error: unsigned conversion from 'int' to 'uint32_t' {aka 'unsigned int'} changes value from '-3' to '4294967293' [-Werror=sign-conversion]
  389 |  background->flags &= ~OBS_HOTKEYS_BACKGROUND_DESKTOP_TRIGGERS;
libobs/obs-nix-portal-shortcuts.c.h:665:27: error: unsigned conversion from 'int' to 'uint32_t' ... changes value from '-33' to '4294967263' [-Werror=sign-conversion]
libobs/obs-nix-portal-shortcuts.c.h:1107:27: error: unsigned conversion from 'int' to 'uint32_t' ... changes value from '-41' to '4294967255' [-Werror=sign-conversion]
libobs-opengl/gl-wayland-egl.c.h:92:87: error: conversion to 'int' from 'uint32_t' {aka 'unsigned int'} may change the sign of the result [-Werror=sign-conversion]
libobs-opengl/gl-wayland-egl.c.h:306:82: error: conversion to 'int' from 'uint32_t' {aka 'unsigned int'} may change the sign of the result [-Werror=sign-conversion]

(The issue quotes GCC 16.2; the same diagnostics reproduce with GCC 15.2, so this
is not a compiler-version regression but the missing Wayland TUs.)

GREEN

Same tree, same command, same flags, after this change: exit=0, zero error:
lines; libobs/libobs.so.30 and libobs-opengl/libobs-opengl.so.30 link.

Each conversion is stated at the boundary and keeps the value the site already
computed:

  • obs-nix-wayland.c.h — the keymap level loop now uses the
    xkb_level_index_t that xkb_keymap_key_get_syms_by_level() takes (it is a
    0..MAX_SHIFT_LEVELS counter, so nothing changes), and the two xkb_keysym_t
    values passed to obs_key_from_virtual_key()'s int parameter are cast once.
    That mirrors the opposite explicit cast already present in
    obs_nix_wayland_key_to_virtual_key() at line 344, and the vtable in
    libobs/obs-nix.h stays int-typed for the X11 and Windows hosts.
  • obs-nix-portal-shortcuts.c.h — the three background-flag clears cast the
    int constant to uint32_t before complementing it, exactly as
    obs-hotkey.c.h:1222 already does for OBS_HOTKEYS_BACKGROUND_CONFIGURE_FAILED.
  • gl-wayland-egl.c.h — the two window-size call sites pass
    gs_init_data's uint32_t cx/cy as int, the type
    wl_egl_window_create() / wl_egl_window_resize() take.

No -Wno-* returns, and no file outside the Wayland/portal host code is touched.

Why the lane missed it

Tracked separately as a follow-up (infra:): the PR and Tier 2 lanes should
compile these host files with the conversion flags, so the next ratchet slice
cannot land green while an app build is red.

…#2885)

The #2625 ratchet turned on -Wconversion/-Wsign-conversion/-Wfloat-conversion
for the libobs and libobs-opengl targets, but the Wayland host TUs are not
compiled by the PR lanes, so their implicit conversions only showed up in an
app build with ENABLE_WAYLAND=ON.

Six conversions, each stated at its boundary with the value the site already
had:

- obs-nix-wayland.c.h: the keymap level loop is an xkb_level_index_t (what
  xkb_keymap_key_get_syms_by_level() takes), and the two xkb_keysym_t values
  handed to obs_key_from_virtual_key()'s int parameter are cast once, matching
  the opposite cast in obs_nix_wayland_key_to_virtual_key().
- obs-nix-portal-shortcuts.c.h: the three flag clears cast the int constant to
  uint32_t before complementing it, as obs-hotkey.c.h already does.
- gl-wayland-egl.c.h: the two window-size calls pass gs_init_data's uint32_t
  cx/cy as int, the type wl_egl_window_create()/wl_egl_window_resize() take.

No -Wno-* returns.

@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.

Reviewed — correct; each site now states the conversion it was already doing.

  • obs-nix-wayland.c.h: xkb_level_index_t level is the counter xkb_keymap_key_get_syms_by_level() takes, and MAX_SHIFT_LEVELS is 4, so the loop bound is unchanged; the two (int)syms[0] casts match the explicit int vtable in obs-nix.h (X11/Windows hosts keep the same signature). No behaviour change.
  • obs-nix-portal-shortcuts.c.h: background->flags is uint32_t (obs-internal.h), and ~(uint32_t)MASK is the same mask as the previous ~MASK after the implicit conversion — the three clears keep clearing exactly the bits they cleared.
  • gl-wayland-egl.c.h: gs_init_data.cx/cy are uint32_t; wl_egl_window_create()/_resize() take int. Sizes above INT_MAX are not a real case, and the value passed is unchanged for every size that fits.

No -Wno-*, no pragma, no touch outside the Wayland/portal host TUs, and the GREEN evidence in the body is a real ENABLE_WAYLAND=ON build of these targets, which the PR lanes do not compile.

Two notes, neither blocking:

  1. The "Why the lane missed it" follow-up you describe as tracked separately (infra:) does not exist as an issue yet — the only open Wayland issue is #2885, which this PR closes. I am not opening one; it is in this tick's report for the maintainer.
  2. libobs/obs-hotkey.c.h:1222 does the same &= ~MASK on the same uint32_t without a cast and is not in the error list; worth the same treatment in a later slice so the two files read alike.

@zackees

zackees commented Oct 29, 2026

Copy link
Copy Markdown
Member Author

Correction to note 1 above: #2890 (infra: no lane compiles the Wayland host TUs) is filed, so the follow-up is tracked — my note crossed with it.

@zackees
zackees added this pull request to the merge queue Oct 29, 2026
zackees added a commit that referenced this pull request Oct 29, 2026
The Tier 2 lane builds obs-nix-portal-shortcut-ids.c.h in the C-reference
library, where 'size_t len = plus - part' is a ptrdiff_t to size_t
conversion and fails at the lane's -Werror=sign-conversion. #2889 states
the three Wayland host TUs; this one file is outside its scope, so the
lane cannot be green without it.
Merged via the queue into master with commit 1099347 Oct 29, 2026
39 checks passed
@zackees
zackees deleted the fix/2885-wayland-conversions branch October 29, 2026 09:11
zackees added a commit that referenced this pull request Oct 29, 2026
#2885 broke a default Linux build with nine -Werror=sign-conversion
diagnostics in obs-nix-wayland.c.h, obs-nix-portal-shortcuts.c.h and
gl-wayland-egl.c.h while every PR lane stayed green: the Tier 2 build
configures ENABLE_WAYLAND=OFF although cmake/linux/defaults.cmake defaults
it ON, so those three unity TUs are compiled by nobody.

Configure -DENABLE_WAYLAND=ON (the build tree and the configure-only Debug
tree) and drop --without-wayland from the ported-group expansion, so the
Wayland ported groups (hotkey state, portal shortcut ids and sets) join the
exclusion list CMake actually builds.

GREEN: uv run python -m unittest ci/test_tier2_wayland_lane.py -> 4 tests OK.

Local graph evidence (validate image a82d9e80, -DENABLE_WAYLAND=ON,
-OBS_BUILD_C_REFERENCE=ON), with #2889's three conversion fixes applied:

  libobs:             libobs.nix-wayland+.h.c.o, libobs.nix-portal-shortcuts+.h.c.o
  libobs-c-reference: libobs.nix-wayland+.h.c.o, libobs.nix-portal-shortcuts+.h.c.o,
                      libobs.ported-nix-portal-shortcut-ids+.h.c.o,
                      libobs.ported-nix-portal-shortcut-sets+.h.c.o

The three TUs compile clean at the lane's -Werror setting, and the two
Wayland ported groups stay out of hybrid libobs, which is what the lane's
excluded-object check requires.

Depends on #2889: master still carries the nine diagnostics this lane would
now report, so the PR is queued after it merges.
zackees added a commit that referenced this pull request Oct 29, 2026
The Tier 2 lane builds obs-nix-portal-shortcut-ids.c.h in the C-reference
library, where 'size_t len = plus - part' is a ptrdiff_t to size_t
conversion and fails at the lane's -Werror=sign-conversion. #2889 states
the three Wayland host TUs; this one file is outside its scope, so the
lane cannot be green without it.
@obs-rust-project-manager obs-rust-project-manager Bot moved this from In review 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
…st#2890) (obs-rust#2894)

* test(ci): pin the Tier 2 Linux lane to the Wayland host sources (obs-rust#2890)

ci/test_tier2_wayland_lane.py fails on master: validate.sh configures
-DENABLE_WAYLAND=OFF and passes --without-wayland to ported_sources.py, so
libobs.nix-wayland+, libobs.nix-portal-shortcuts+ and
opengl.nix-wayland+ reach no lane.

RED: uv run python -m unittest ci/test_tier2_wayland_lane.py
  FAIL: test_every_tier2_configure_enables_wayland
  FAIL: test_no_wayland_opt_out_is_passed_to_the_source_sets

* ci: build the Wayland host sources in the Tier 2 Linux lane (obs-rust#2890)

obs-rust#2885 broke a default Linux build with nine -Werror=sign-conversion
diagnostics in obs-nix-wayland.c.h, obs-nix-portal-shortcuts.c.h and
gl-wayland-egl.c.h while every PR lane stayed green: the Tier 2 build
configures ENABLE_WAYLAND=OFF although cmake/linux/defaults.cmake defaults
it ON, so those three unity TUs are compiled by nobody.

Configure -DENABLE_WAYLAND=ON (the build tree and the configure-only Debug
tree) and drop --without-wayland from the ported-group expansion, so the
Wayland ported groups (hotkey state, portal shortcut ids and sets) join the
exclusion list CMake actually builds.

GREEN: uv run python -m unittest ci/test_tier2_wayland_lane.py -> 4 tests OK.

Local graph evidence (validate image a82d9e80, -DENABLE_WAYLAND=ON,
-OBS_BUILD_C_REFERENCE=ON), with obs-rust#2889's three conversion fixes applied:

  libobs:             libobs.nix-wayland+.h.c.o, libobs.nix-portal-shortcuts+.h.c.o
  libobs-c-reference: libobs.nix-wayland+.h.c.o, libobs.nix-portal-shortcuts+.h.c.o,
                      libobs.ported-nix-portal-shortcut-ids+.h.c.o,
                      libobs.ported-nix-portal-shortcut-sets+.h.c.o

The three TUs compile clean at the lane's -Werror setting, and the two
Wayland ported groups stay out of hybrid libobs, which is what the lane's
excluded-object check requires.

Depends on obs-rust#2889: master still carries the nine diagnostics this lane would
now report, so the PR is queued after it merges.

* ci: state the portal shortcut substring length (obs-rust#2890)

The Tier 2 lane builds obs-nix-portal-shortcut-ids.c.h in the C-reference
library, where 'size_t len = plus - part' is a ptrdiff_t to size_t
conversion and fails at the lane's -Werror=sign-conversion. obs-rust#2889 states
the three Wayland host TUs; this one file is outside its scope, so the
lane cannot be green without it.
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.

bug: libobs: Wayland host files fail -Wsign-conversion on GCC 16

1 participant