Skip to content

build(obs-scripting): Exempt the SWIG sources from -Wmissing-prototypes (#2703) - #2704

Merged
zackees merged 3 commits into
masterfrom
infra/2703-scripting-missing-prototypes
Oct 27, 2026
Merged

zackees merged 3 commits into
masterfrom
infra/2703-scripting-missing-prototypes

Conversation

@zackees

@zackees zackees commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

Fixes #2703

The Linux app builds (Ubuntu OBS-Studio-Rust, Flatpak) are red on master since #2678 put -Wmissing-prototypes/-Wstrict-prototypes in the global C option lists: the SWIG-generated glue in shared/obs-scripting declares its entry points with no prototype in scope, so the obs-scripting target fails at -Werror and neither lane reaches packaging. #2696 fixed the same files for -Wpedantic three hours earlier; the exemption is per-diagnostic, so it does not cover #2678's flags.

No PR lane sees this: the same SHA's PR run was green while Scheduled on it failed both lanes.

RED — 62606d055

ci/test_scripting_missing_prototypes.py (new) walks the four sites that already exempt the same generated files from -Wcast-qual (obs-scripting in cmake/lua.cmake and cmake/python.cmake, plus the obspython and obslua wrapper targets) and requires -Wno-missing-prototypes in the same C-only COMPILE_LANG_AND_ID generator expression; it also pins that the global C lists keep -Wmissing-prototypes and -Wstrict-prototypes so the #2624 ratchet still applies to first-party code.

On master it fails at all four sites:

AssertionError: '-Wno-missing-prototypes' not found in {'-Wno-unused-parameter', '-Wno-cast-qual', '-Wno-double-promotion', '-Wno-undef', '-Wno-pedantic'} : obspython: ...
AssertionError: '-Wno-missing-prototypes' not found in {'-Wno-undef', '-Wno-pedantic', '-Wno-double-promotion', '-Wno-cast-qual'} : obslua: ...
... (obs-scripting lua.cmake, python.cmake)
Ran 2 tests — FAILED (failures=4)

GREEN — a59ab09eb

One flag added beside the existing exemptions; no generated file edited, no global flag relaxed, nothing added outside a C-only generator expression:

Site before after
shared/obs-scripting/cmake/lua.cmake (obs-scripting) -Wno-cast-qual -Wno-cast-qual;-Wno-missing-prototypes
shared/obs-scripting/cmake/python.cmake (obs-scripting) -Wno-cast-qual;-Wno-pedantic +;-Wno-missing-prototypes
shared/obs-scripting/obspython/CMakeLists.txt …;-Wno-pedantic + -Wno-missing-prototypes
shared/obs-scripting/obslua/CMakeLists.txt …;-Wno-pedantic + -Wno-missing-prototypes

The obspython/obslua wrapper objects were not reached by either red lane (ninja stopped in obs-scripting first), so their addition follows #2696, which exempted all three targets for -Wpedantic — the same generated wrapper sources, same reason.

Evidence this fixes

Scheduled Repository Actions dispatched on fix/2699-app-build-soldr at c7769380 (run 40591042433):

  • Build 🧱 / Ubuntu 🐧 (OBS-Studio-Rust) — failure, job 122495240031: 11 -Werror=missing-prototypes diagnostics in shared/obs-scripting, ninja: build stopped
  • Build 🧱 / Flatpak 📦 — failure, job 122495240167: the same ten Lua-object diagnostics, then Build failed: … xvfb-run failed with exit code 1

Local checks

  • uv run python -m unittest ci.test_scripting_missing_prototypes ci.test_scripting_pedantic_exemption — 5 tests, OK (RED before the GREEN: 4 failures).
  • uvx [email protected] check ci/test_scripting_missing_prototypes.py — clean (no ruff format, per the repo's ruff.toml).
  • uv run --no-project ci/local_gate.py --only gersemi — ok (the new target_compile_options call is gersemi's own layout).
  • uv run python -m unittest ci.test_uv_run and ci.test_ci_toml — 5 + 41 tests, OK.

Verification pending (this PR's real gate)

Verification — what the dispatched lanes actually show

Three workflow_dispatch runs of Scheduled Repository Actions on this branch, in order:

  1. a59ab09e, run 40594398865 — Ubuntu 🐧 compiled past all eleven -Wmissing-prototypes diagnostics and stopped one TU later on obs-scripting-python.c.h:741:25 error: function declaration isn't a prototype [-Werror=strict-prototypes]; Flatpak 📦 never reached the compiler (see bug: Flatpak lane fails to spawn ci/flatpak_builder_lint.py — the action passes ${{ github.workspace }} where the job runs in /__w (#2702 regression) #2705).
  2. ec608e33, run 40595018476 — the obs-scripting target now builds: 9 C objects compiled, zero diagnostics, and the lane advanced to libobs-opengl.
  3. That lane then stops on a different class, in first-party code: libobs-opengl/gl-wayland-egl.c.h:90:23: error: no previous prototype for 'gl_wayland_egl_windowinfo_create'. That is a build(cmake): compile C with -Wmissing-prototypes and -Wstrict-prototypes (#2624) #2678 gap (its -fsyntax-only replay covered the Tier 2 compdb, not the Ubuntu app build's Wayland/Qt TUs), one token from fixed (static, as gl-x11-egl.c.h:236 already does), and filed on the ratchet issue build(cmake): Drop -Wno-missing-prototypes and -Wno-strict-prototypes #2624 rather than folded in here.

So the exemption this PR adds is proven by (2), and the two lanes that carry it are still red only for causes outside this diff: #2705 (Flatpak, fails before compiling) and the #2624 backfill (Ubuntu, first-party prototype). PR CI is green.

…2703)

#2678 enabled -Wmissing-prototypes tree-wide and the Ubuntu app build
(OBS-Studio-Rust) and the Flatpak build now stop compiling
shared/obs-scripting: the SWIG-generated glue declares its entry points
with no prototype in scope.

The test fails on master at all four sites that already exempt the same
generated files from -Wcast-qual, and it pins that the global C lists keep
the rule so the #2624 ratchet still applies to first-party code.
…es (#2703)

#2678 enabled -Wmissing-prototypes tree-wide; the Ubuntu app build
(OBS-Studio-Rust) and the Flatpak build then stopped compiling
shared/obs-scripting, because the SWIG-generated glue declares its entry
points with no prototype in scope:

  obs-scripting-lua-frontend.c.h:320   add_lua_frontend_funcs
  obs-scripting-lua-source.c.h:766     undef_lua_script_sources
  obs-scripting-lua.c.h:1075..1320     obs_lua_script_* / obs_lua_load / obs_lua_unload
  obs-scripting-python-frontend.c.h:418 add_python_frontend_funcs

Generated code cannot be edited, so each SWIG target opts out of that one
diagnostic beside the -Wno-cast-qual (#516) and -Wno-pedantic (#2696)
exemptions it already carries: obs-scripting (lua.cmake, python.cmake),
obspython and obslua for their own wrapper objects. The global C lists keep
-Wmissing-prototypes and -Wstrict-prototypes, so the #2624 ratchet still
applies to first-party code.

RED: ci/test_scripting_missing_prototypes.py fails at all four sites.
GREEN: it passes; ci/test_scripting_pedantic_exemption.py, ci.test_uv_run
and ci.test_ci_toml stay green, gersemi ok.
The Ubuntu app build passed the -Wmissing-prototypes sites and then stopped
one TU later on the same generated glue, which declares functions as
'foo()' rather than 'foo(void)':

  shared/obs-scripting/obs-scripting-python.c.h:741:25
  error: function declaration isn't a prototype [-Werror=strict-prototypes]

#2678 enabled both rules together, so both exemptions travel together; the
pin test now asserts each C-only genex carries both.

@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. The exemption is the right shape and the test holds both ends of it.

RED → GREEN, checked locally in a worktree of the PR head:

  • on the test-only commit 62606d0 the new test fails as intended — '-Wno-missing-prototypes' not found in {'-Wno-cast-qual'} for both obs-scripting sites and obspython;
  • on a59ab09 it passes (Ran 2 tests ... OK).

Scope is complete. grep -rn Wno-cast-qual over shared/obs-scripting finds exactly the four sites the test walks (cmake/lua.cmake, cmake/python.cmake, obslua/CMakeLists.txt, obspython/CMakeLists.txt), so there is no fifth SWIG target left at the rule. The exemption stays inside the COMPILE_LANG_AND_ID:C,... generator expression, so C++ in the same target keeps the diagnostic, and the second test pins that the global _obs_clang_c_options and the GNU C option line still carry -Wmissing-prototypes/-Wstrict-prototypes, which is what keeps #2624's ratchet meaningful for first-party code.

Two things worth knowing, neither a blocker:

  1. -Wstrict-prototypes came in with the same change (#2678). It fires on a declaration like int f();, which is the other half of "no prototype in scope". If a Linux app lane comes back red on these files after this lands, the log will name that diagnostic rather than this one, and the same four sites take it the same way. Nothing in the PR claims otherwise, so I read the evidence as: only -Wmissing-prototypes fired.
  2. No PR lane proves this fix. That is the point of the issue (#2703: same SHA green on PR, red on Scheduled), so after the merge the proof is the next Scheduled/push run of the Ubuntu OBS-Studio-Rust and Flatpak lanes, not this PR's checks. Worth watching those rather than trusting this PR's green.

Queuing it once its checks settle.

@zackees

zackees commented Oct 27, 2026

Copy link
Copy Markdown
Member Author

Re-checked on the amended head ec608e3 ("Exempt -Wstrict-prototypes too"), which landed while I was writing the review above: it answers point 1 exactly, and the second flag is not just added to the flag lists — the test now requires both -Wno-missing-prototypes and -Wno-strict-prototypes inside the same C-only guard at each of the four sites.

Verified locally in a worktree, RED first:

  • ec608e3's test against a59ab09's tree (the missing-prototypes-only exemption) → fails, 4 subtest AssertionErrors;
  • ec608e3's own tree → Ran 2 tests ... OK.

So the RED still precedes the GREEN for the new flag, and the global-flag assertions are unchanged. I also see the Scheduled workflow_dispatch dispatched on this head — that is the lane that can actually prove the fix (#2703), so I will queue on PR CI once it is green and let that run speak for the app builds.

@zackees

zackees commented Oct 27, 2026

Copy link
Copy Markdown
Member Author

The dispatched run found one more diagnostic in the same generated glue — fixed in ec608e33

Scheduled on a59ab09e (run 40594398865, job 122506634010) got past every -Wmissing-prototypes site — the compile line now carries -Wno-missing-prototypes -Wno-pedantic — and stopped one TU later on the other half of #2678:

shared/obs-scripting/obs-scripting-python.c.h:741:25: error: function declaration isn't a prototype [-Werror=strict-prototypes]

Same generated files, same target, so the same one-line exemption now covers both rules (-Wno-missing-prototypes;-Wno-strict-prototypes at all four sites) and ci/test_scripting_missing_prototypes.py asserts both per C-only generator expression. Local: 5 tests OK, gersemi ok, ruff clean. HEAD is now ec608e33; a fresh Scheduled dispatch (run 40595018476) is the verification.

Flatpak 📦 is blocked by a different, newer regression — not by this diff

The same run's Flatpak lane never reached the compiler: it died in Validate Flatpak manifest, in the composite action #2702 created:

uv run --no-project "/home/runner/work/obs-studio/obs-studio/ci/flatpak_builder_lint.py" guard --artifact 'manifest'
error: Failed to spawn: …/ci/flatpak_builder_lint.py
  cause: No such file or directory (os error 2)

The job's own steps run in /__w/obs-studio/obs-studio, so the ${{ github.workspace }} path the action passes does not exist there. The same dispatched lane on a pre-#2702 SHA got through the lint step, so this is that merge, not this PR. Filed as #2705 with the fix shape (the action already sets working-directory, so address the module relatively as the neighbouring flatpak_compiler_diagnostics.py step does); it needs its own PR and dispatch. Until then this PR's Flatpak verification is blocked by #2705, and Ubuntu 🐧 (OBS-Studio-Rust) is the compile proof.

@zackees
zackees added this pull request to the merge queue Oct 27, 2026
Merged via the queue into master with commit 70d0885 Oct 27, 2026
68 of 75 checks passed
@zackees
zackees deleted the infra/2703-scripting-missing-prototypes branch October 27, 2026 22:58
@zackees

zackees commented Oct 27, 2026

Copy link
Copy Markdown
Member Author

Heads-up from the Scheduled workflow_dispatch you dispatched on ec608e3 (run 40595018476): the Linux app lanes still fail with this applied, so this PR does not yet make master green and Fixes #2703 would close the issue while the lane is still red.

Build 🧱 / Ubuntu 🐧 (OBS-Studio-Rust) (job 122510595427):

[326/437] Building C object libobs-opengl/CMakeFiles/libobs-opengl.dir/build/opengl.nix-wayland+.h.c.o
FAILED: libobs-opengl/CMakeFiles/libobs-opengl.dir/build/opengl.nix-wayland+.h.c.o
.../libobs-opengl/gl-wayland-egl.c.h:90:23: error: no previous prototype for 'gl_wayland_egl_windowinfo_create' [-Werror=missing-prototypes]

That is first-party C (gl-wayland-egl.c.h:90 on master: struct gl_windowinfo *gl_wayland_egl_windowinfo_create(const struct gs_init_data *info) with no prior declaration in scope), so the #2696/#2703 exemption shape does not apply — it wants the prototype (or static), and #2624's ratchet should stay live for it. The build stops at the first failure, so there may be more sites behind this one in libobs-opengl and elsewhere.

Build 🧱 / Flatpak 📦 failed in the same run for a different and unrelated reason — the ported action handing uv the runner's host path inside the container — which I fixed separately in #2707; that failure is mine, not this PR's.

My review above stands on the change itself: it is correct and needed, it just is not the whole of #2703.

MCPVOT pushed a commit to MCPVOT/obs-studio that referenced this pull request Oct 30, 2026
…ust#2703) (obs-rust#2710)

* test: Pin that libobs-opengl platform definitions are static or declared (obs-rust#2703)

RED: ci/test_platform_missing_prototypes.py fails on master with
libobs-opengl/gl-wayland-egl.c.h:90: gl_wayland_egl_windowinfo_create — a
file-scope definition that is neither static nor declared in a header. The app
builds are the only lanes that compile it and they stop there with
-Werror=missing-prototypes.

* fix(libobs-opengl): Make the Wayland windowinfo factory static (obs-rust#2703)

GREEN: the helper is only reached through its gl_winsys_vtable slot, so it is
file-scope private; the X11 sibling gl_x11_egl_windowinfo_create is already
static. This clears the next -Wmissing-prototypes failure the Ubuntu and
Flatpak app lanes hit after obs-rust#2704.
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.

infra: Ubuntu and Flatpak app builds fail on -Wmissing-prototypes in SWIG-generated obs-scripting sources (#2678 regression)

1 participant