Skip to content

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

Closed

Description

@rdoupe

A Linux build with Wayland on (ENABLE_WAYLAND=ON, the default) no longer compiles on master with GCC 16.2: the explicit-conversion PRs for #2625 (#2871 for libobs-opengl, #2877 for libobs) turned on -Wconversion -Wsign-conversion -Wfloat-conversion for those targets, and the Wayland and portal host files still have implicit sign conversions, so -Werror stops the build. PR CI didn't catch it because the PR lanes don't compile these host files; the app builds (AppImage, Flatpak) do.

Where

  • libobs/obs-nix-wayland.c.h:66, :70, :158 (xkb_level_index_t from int, int from xkb_keysym_t), and two more in the same file;
  • libobs/obs-nix-portal-shortcuts.c.h: six;
  • libobs-opengl/gl-wayland-egl.c.h:92 (two) and :306: int from uint32_t.
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]
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]

Reproduce

On master (ee3273d), Arch Linux, GCC 16.2.1, default options: cmake -S . -B build -G Ninja -DENABLE_UNIT_TESTS=ON && ninja -C build libobs libobs-opengl.

Fix

Make each conversion explicit, as the rest of #2625 did, with no change in behaviour; and have a lane that compiles the Wayland host files with the conversion flags, so the next ratchet step can't miss them.

Activity

  1. added
    bug
    on Oct 29, 2026
  2. zackees commented on Oct 29, 2026

    @zackees
    Member

    Claiming: investigation

    Two source families, both reachable from a default ENABLE_WAYLAND=ON Linux build, so I can state each conversion at its boundary and check it with the conversion flags on this host (GCC 15 here, flags identical; the diagnostics are the same -Wconversion/-Wsign-conversion class GCC 16 reports).

    Plan: libobs/obs-nix-wayland.c.h (5), libobs/obs-nix-portal-shortcuts.c.h (6), libobs-opengl/gl-wayland-egl.c.h (3) — explicit casts that keep the value each site already computed, no -Wno-*, plus a check that the wayland TUs really are compiled by the new ratchet so the next slice cannot miss them.

  3. added
    needs-investigation
    on Oct 29, 2026
  4. zackees commented on Oct 29, 2026

    @zackees
    Member

    /ready

  5. added
    ready
    and removed
    needs-investigation
    on Oct 29, 2026
  6. zackees commented on Oct 29, 2026

    @zackees
    Member

    Claiming: Wayland host conversions

    PR #2889 — fix/2885-wayland-conversions, one commit 1f3fe552d (nine conversion sites stated across obs-nix-wayland.c.h, obs-nix-portal-shortcuts.c.h, gl-wayland-egl.c.h).

    RED reproduced locally on 07340d52e with -DENABLE_WAYLAND=ON and the ratchet flags on (GCC 15.2, ninja libobs libobs-opengl → nine -Werror=sign-conversion errors, so this is not a GCC 16-only regression). GREEN is the same command on the branch: exit=0, zero error: lines, both shared libraries link. No -Wno-* returns.

    The lane gap the issue's Fix section asks for (a job that compiles the Wayland host files with the conversion flags) is filed separately as an infra: follow-up rather than widened into this PR: it changes which lane runs, not the code.

  7. zackees commented on Oct 29, 2026

    @zackees
    Member

    Filed the lane gap as #2890 (infra:): the CI build passes -DENABLE_WAYLAND=OFF (build-project.yaml:1854) and the Tier 2 volume from the #2625 replay records ENABLE_WAYLAND:BOOL=OFF, while the option defaults to ON, which is exactly why #2889s nine diagnostics never appeared in a lane. #2889 fixes the code; #2890 makes the lane see it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugready

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions