Skip to content

build(cmake): compile C with -Wmissing-prototypes and -Wstrict-prototypes (#2624) - #2678

Merged
zackees merged 8 commits into
masterfrom
infra/2624-missing-prototypes
Oct 27, 2026
Merged

zackees merged 8 commits into
masterfrom
infra/2624-missing-prototypes

Conversation

@zackees

@zackees zackees commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

Refs #2624 — the two -Wno-* pins are dropped and the tree is clean; this stays open until the macOS/Windows lanes confirm.

RED

48db30451… ecb7346d8: build(cmake): RED: enable -Wmissing-prototypes and -Wstrict-prototypes (#2624).
Drops -Wno-missing-prototypes / -Wno-strict-prototypes from
cmake/common/compiler_common.cmake (_obs_clang_common_options) and adds the positive
forms to the C-only lists — _obs_clang_c_options and the GNU C line in
cmake/linux/compilerconfig.cmake. The warnings are not in -Wall/-Wextra, so the pin
cannot simply be deleted; this is where the two ratchets come from (#516).

How it fails: uv run ci/local_gate.py --lane tier2-linux (gcc 15.2) goes red with 228
-Werror= findings across ~75 files (the RED tick's log; master has moved since).

GREEN

ecb7346d8… 99ac5aef7: first-party prototypes + vendored exemptions.

area fix
first-party (libobs, libobs-opengl, plugins/*, shared/*, 46 files) declare each function before its definition; (void) for the empty-parameter declarations and definitions the C-only -Wstrict-prototypes flags
test/cmocka target-scoped -Wno-missing-prototypes / -Wno-strict-prototypes, as the #2624 decision asks. No C test edited.
deps/glad, rnnoise/include include dir published as SYSTEM. Their headers declare with empty parameter lists, so a target-scoped option set on the library cannot reach the consumer TUs that include them (deps/glad/include/glad/glad.h alone is 38 of the sites). -isystem suppresses both in every consumer.
librtmp (obs-outputs), rnnoise sources extend the existing per-file / per-target exemptions beside deps/glad and deps/libcaption.

Evidence — the lane cannot see this change

uv run ci/local_gate.py --lane tier2-linux prints clean, but that is a zccache
artifact
: zccache does not key on the compile flags, so once the flag list changes the
libobs/plugins C objects are served from cache and never recompiled (the run's
tree.build.log has no Building C object libobs/… / plugins/… lines, and the .o
files predate the run). Do not read that as GREEN.

The honest check is a zccache-bypassed replay of the tree's own compile commands:

ninja -t compdb   # in the Tier 2 build volume
# strip the zccache wrapper, swap `-c <src>` for `-fsyntax-only <src>`, run each through sh

over all 1255 C translation units:

tree findings compile errors
pinned tree, before the GREEN fixes 255 (177 unique sites) 0
this branch 0 0

./lint is ok.

Follow-up commits on top of the GREEN

commit why
edafb2876 plugins/frontend-tools/frontend-tools.c.h declared its four module functions with empty parameter lists; the Qt Frontend Linux lane compiles C with -Wstrict-prototypes and went red. Declared (void).
2841c878d the same shape in plugins/text-freetype2/find-font.c.h's extern uint32_t get_font_checksum(); → (void), matching the windows/cocoa definitions.

macOS and Windows confirmed

PR CI's clang (macOS) and MSVC (Windows) lanes are green on 2841c878d
(run 40572116277: Qt Frontend Linux, Fast Gate, Rust Tier 2 Linux, Rust Tests
macOS/Windows, Rust Tier 2 macOS/Windows all success), so both halves of the
flag are covered. Fixes #2624.

#2624)

Drops the two -Wno-* pins and adds the positive forms to the C-only flag
lists (clang common->C list; the GNU C line). The warnings are not in
-Wall/-Wextra, so the pin cannot simply be removed.
…#2624)

Drops the two -Wno-* pins from the C flag lists and satisfies the strict pair
everywhere they now reach:

- first-party: declare each function before its definition (libobs,
  libobs-opengl, plugins/*, shared/*, 46 files), and use (void) for the
  empty-parameter declarations and definitions that -Wstrict-prototypes flags.
- test/cmocka: target-scoped -Wno-missing-prototypes / -Wno-strict-prototypes,
  as the #2624 decision asks. No C test is edited.
- vendored: deps/glad and rnnoise publish their include dir as SYSTEM (their
  headers declare with empty parameter lists, so a target-scoped option cannot
  reach the consumers that include them), and librtmp's and rnnoise's own
  sources extend their existing per-file / per-target exemptions next to
  deps/glad and deps/libcaption.

Verified locally. `uv run ci/local_gate.py --lane tier2-linux` reports clean
but cannot see a flag-list change: zccache does not key on the compile flags,
so the C objects are served from cache and never recompiled (no `Building C
object …` lines in the run's tree.build.log). The honest check is a zccache-
bypassed `-fsyntax-only` replay of every C translation unit in the Tier 2 tree
(the tree's own flags, one TU at a time): on this branch it reports **0
findings and 0 compile errors** over 1255 TUs, down from **255 findings across
177 sites** on the same tree before this commit. `./lint` is ok.

Refs #2624
rdoupe and others added 6 commits October 27, 2026 12:34
* test: Check getters with no core

obs_get_video_info() returns false when there is no core (#1509), but
obs_get_video_sdr_white_level(), obs_get_video_hdr_nominal_peak_level(),
obs_get_audio_info() (and obs_get_audio_info2() through it),
obs_nv12_tex_active() and obs_p010_tex_active() read through the NULL
core before obs_startup() or after obs_shutdown().

test_no_core_getters calls each of them without starting the core, one
case each. On master, every case but obs_get_video_info's crashes.

Refs #2566.

* libobs: Guard the level and texture getters

With no core (before obs_startup() or after obs_shutdown()), give the
answer each getter already gives with no video or no audio, as
obs_get_video_info() does since #1509:

- obs_get_video_sdr_white_level(): 300;
- obs_get_video_hdr_nominal_peak_level(): 1000;
- obs_get_audio_info(): false, the out-struct untouched, so
  obs_get_audio_info2() returns false too;
- obs_nv12_tex_active() and obs_p010_tex_active(): false.

Nothing changes while the core exists.

Fixes #2566.

Local-Gate: v1 tree=7c46ca3f9f044da99de6a02ef6d71197be09b705 secs=2361 lanes=lint:run,rust-test:run,cross:run,tier2-linux:run
Ci-Attestation: {"at":1793087831,"gate":"rust/all/fmt","host":"linux-x86_64","key":"2cab03d3eb9db6e60c5e4e4c2fe2abd64f0e96fd82b99c68fc828e1eaf1c10fe","lane":"lint","parents":["9a8f0540cdfcae093066cba16f9711741c1be603"],"secs":48,"stamp":"3cb8a1a86c5e88a21471c14b149c2316","tree":"7c46ca3f9f044da99de6a02ef6d71197be09b705","v":1,"via":"run"}
Ci-Attestation: {"at":1793087831,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"2cab03d3eb9db6e60c5e4e4c2fe2abd64f0e96fd82b99c68fc828e1eaf1c10fe","lane":"lint","parents":["9a8f0540cdfcae093066cba16f9711741c1be603"],"secs":48,"stamp":"2ad58fcba46ec4d8bec7ffeb235b6408","tree":"7c46ca3f9f044da99de6a02ef6d71197be09b705","v":1,"via":"run"}
Ci-Attestation: {"at":1793087831,"gate":"rust/x86_64-unknown-linux-gnu/test","host":"linux-x86_64","key":"4e02e5fb00c2bba76a8b54d9804314fd893b4a7651b50d82c224c1c10ff88f20","lane":"rust-test","parents":["9a8f0540cdfcae093066cba16f9711741c1be603"],"secs":222,"stamp":"d452f5fe974f4411a393fae94b11a5f1","tree":"7c46ca3f9f044da99de6a02ef6d71197be09b705","v":1,"via":"run"}
Ci-Attestation: {"at":1793087831,"gate":"rust/x86_64-pc-windows-msvc/clippy","host":"linux-x86_64","key":"4f291d63669d098462de945660e7ed5042ca0d393321fcef77c635813bcca169","lane":"cross","parents":["9a8f0540cdfcae093066cba16f9711741c1be603"],"secs":71,"stamp":"b6e8a2b6337beac5183d5a395b9b9767","tree":"7c46ca3f9f044da99de6a02ef6d71197be09b705","v":1,"via":"run"}
Ci-Attestation: {"at":1793087831,"gate":"rust/x86_64-pc-windows-msvc/dylint","host":"linux-x86_64","key":"4f291d63669d098462de945660e7ed5042ca0d393321fcef77c635813bcca169","lane":"cross","parents":["9a8f0540cdfcae093066cba16f9711741c1be603"],"secs":71,"stamp":"2e8568072390af1df4e660265a492d1f","tree":"7c46ca3f9f044da99de6a02ef6d71197be09b705","v":1,"via":"run"}
Ci-Attestation: {"at":1793087831,"gate":"rust/aarch64-apple-darwin/clippy","host":"linux-x86_64","key":"4f291d63669d098462de945660e7ed5042ca0d393321fcef77c635813bcca169","lane":"cross","parents":["9a8f0540cdfcae093066cba16f9711741c1be603"],"secs":71,"stamp":"b9fe35d949f1291f099c0daf6d74873b","tree":"7c46ca3f9f044da99de6a02ef6d71197be09b705","v":1,"via":"run"}
Ci-Attestation: {"at":1793087831,"gate":"rust/aarch64-apple-darwin/dylint","host":"linux-x86_64","key":"4f291d63669d098462de945660e7ed5042ca0d393321fcef77c635813bcca169","lane":"cross","parents":["9a8f0540cdfcae093066cba16f9711741c1be603"],"secs":71,"stamp":"1db5eb4dda49b2e54fe29965193e784d","tree":"7c46ca3f9f044da99de6a02ef6d71197be09b705","v":1,"via":"run"}
Ci-Attestation: {"at":1793087831,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"1107a9b363febecf6deee7b41414302795d6d8b673a5361e6b640814be90eb97","lane":"tier2-linux","parents":["9a8f0540cdfcae093066cba16f9711741c1be603"],"secs":2021,"stamp":"b20646a7b4538eef9546ff296e492121","tree":"7c46ca3f9f044da99de6a02ef6d71197be09b705","v":1,"via":"run"}

* test: Skip the no-core cases when a core exists

A group setup that refused a started core turned the file into seven
failures. Skip each case instead, and say in the header that only the
never-started case runs: after obs_shutdown() the getters take the same
no-core branch.

Refs #2566.

* docs: Mark the no-core getters line pending

The ledger dates an entry when it merges.

Refs #2566.
…2675)

* ci: Pin the cook dev-dependency features and the test lanes' --tests (#2661)

RED. The cook for the lanes that build tests must include the workspace's
dev-dependencies, and a member's `default-features = true` override is
dropped by the cargo-chef recipe (the #2603/#2604 defect), so the cook
either fails or serves the wrong feature set.

`test_cook_profiles.py` now pins:
- `--profile dev -- --tests` for `rust-tests-linux` (its non-core branch)
  and `rust-tests`;
- an explicit feature list equal to each crate's own `default` for the
  `proptest`/`base64`/`memchr`/`sha2` member entries, instead of
  `{ workspace = true, default-features = true }`.

Fails on master: 2 profile-flag assertions and 12 manifest assertions.

* ci: Cook the workspace dev-dependencies for the test lanes (#2661)

GREEN. The lanes that build tests now cook the workspace's dev-dependencies,
and the member manifests declare the re-enabled defaults as explicit feature
lists so the cargo-chef recipe keeps them.

- `.github/workflows/build-project.yaml`: `rust-tests-linux` (its non-core
  branch) and `rust-tests` pass `--profile dev -- --tests`. The `core`
  branch keeps `--release`, and the cross-lint/cross-compile/container/tier2
  lanes are unchanged.
- ten member manifests: `proptest`, `base64`, `memchr` and `sha2` use the
  #2604 pattern (`features = [...]` equal to the crate's own `default`)
  instead of `{ workspace = true, default-features = true }`, which the
  cargo-chef recipe drops for a `[workspace.dependencies]` entry declared
  with `default-features = false` (#2603).

Local evidence: `ci/test_cook_profiles.py`, `test_feature_sets.py`,
`test_test_binary_cap.py`, `test_workspace_dependencies.py`,
`test_rust_cache_policy.py`, `test_cook_cache_budget.py` and
`test_ci_toml.py` pass; `soldr cargo metadata --locked` resolves (the
feature names are valid) and reports the same effective feature closure per
crate as `default`. `ruff check` clean.
…#2677)

* test(ci): Pin the dead sparkle-appcast action and its exception as gone (#2676)

RED: test_upstream_appcast_jobs_are_gone asserts the unreferenced
.github/actions/sparkle-appcast composite action and its ci-lint GEN-005
exception are gone; it fails on master, where both are still present.

* ci: Delete the dead upstream sparkle-appcast composite action (#2676)

Nothing references .github/actions/sparkle-appcast/: the fork removed upstream's
Sparkle appcast jobs from publish.yaml (pinned by
ci/test_no_upstream_updater.py::test_upstream_appcast_jobs_are_gone) and left the
action behind. Delete it and its ci-lint GEN-005 exception.

GREEN: ci-lint precheck 505 -> 497 approved exceptions (GEN-005 265 -> 257),
11 violations / 10 needs_review unchanged; ci/test_no_upstream_updater.py OK.
#2676) (#2679)

* test(ci): Pin the dead run-clang-format and run-gersemi actions as gone (#2676)

RED: DeadFormatActionsTest asserts both composite actions (and their ci.toml
GEN-005 exceptions) are gone; it fails on master, which still carries both.
#984 moved the checks to `ci/local_gate.py --only clang-format|gersemi` and
left the actions behind, unreferenced.

* ci: Delete the dead run-clang-format and run-gersemi composite actions (#2676)

#984 moved both checks to the local gate's pinned uvx tools
(`uv run --no-project ci/local_gate.py --only clang-format|gersemi`) and left
upstream's composite actions behind. Nothing in .github/workflows references
them: the only `uses: ./.github/actions/run-*` in check-format.yaml is
run-swift-format, which stays. `build-aux/run-clang-format` and
`build-aux/run-gersemi` are different files and stay.

GREEN: ci-lint precheck 497 -> 491 approved exceptions (GEN-005 257 -> 251),
11 violations / 10 needs_review unchanged; ci/test_format_jobs.py OK.
The Qt Frontend Linux lane now compiles C with -Wstrict-prototypes, and
this first-party header declared its four module functions with empty
parameter lists. Declare them (void) so the lane builds.

Refs #2624
The C-only -Wstrict-prototypes flags this remaining empty-parameter
declaration in the text-freetype2 unity source; declare it (void) to
match the definitions in the windows/cocoa variants.

Refs #2624
@obs-rust-project-manager obs-rust-project-manager Bot moved this to In progress in obs-rust Multiview Oct 27, 2026
@zackees
zackees marked this pull request as ready for review October 27, 2026 20:15
@zackees

zackees commented Oct 27, 2026

Copy link
Copy Markdown
Member Author

Windows and macOS lanes confirmed on run 40572116277 (all jobs green, no failures): Rust Tier 2 windows-2025-vs2026 pass 9m26s, Rust Tests 🦀 (windows-2025-vs2026) pass 8m11s, Rust Tier 2 macos-26 pass 10m5s, Rust Tests 🦀 (macos-26) pass 10m11s, Rust Cross Lint 🦀 (Windows, macOS) pass 5m4s; Linux Fast Gate, Tier 2 and Qt lanes pass as well. The acceptance criterion in #2624 (Linux and macOS CMake builds clean with neither -Wno-missing-prototypes nor -Wno-strict-prototypes in any flag list) is met, so this is no longer a draft.

Marking ready and handing off to the coordinator for the queue.

@zackees
zackees added this pull request to the merge queue Oct 27, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 27, 2026
@zackees
zackees added this pull request to the merge queue Oct 27, 2026
Merged via the queue into master with commit 341468f Oct 27, 2026
38 checks passed
@zackees
zackees deleted the infra/2624-missing-prototypes branch October 27, 2026 21:10
zackees added a commit that referenced this pull request Oct 27, 2026
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.
@obs-rust-project-manager obs-rust-project-manager Bot moved this from In progress to Done in obs-rust Multiview Oct 27, 2026
MCPVOT pushed a commit to MCPVOT/obs-studio that referenced this pull request Oct 30, 2026
…es (obs-rust#2703) (obs-rust#2704)

* ci: Pin that the SWIG scripting targets exempt -Wmissing-prototypes (obs-rust#2703)

obs-rust#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 obs-rust#2624 ratchet still applies to first-party code.

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

obs-rust#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 (obs-rust#516) and -Wno-pedantic (obs-rust#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 obs-rust#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.

* build(obs-scripting): Exempt -Wstrict-prototypes too (obs-rust#2703)

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]

obs-rust#2678 enabled both rules together, so both exemptions travel together; the
pin test now asserts each C-only genex carries both.
MCPVOT pushed a commit to MCPVOT/obs-studio that referenced this pull request Oct 30, 2026
…obs-rust#2833)

A pin-drop that is clean on a Tier 2 tree can still fail a Scheduled run,
because many plugin and platform sources only compile in the app builds
(obs-rust#2678, obs-rust#2710). Record the cheap enumeration: configure the AppImage tree
and replay its compdb. Refs obs-rust#2624.

Co-authored-by: zackees <[email protected]>
MCPVOT pushed a commit to MCPVOT/obs-studio that referenced this pull request Oct 30, 2026
…#2624) (obs-rust#2850)

* build(clang): drop the last two -Wno-strict-prototypes pins (obs-rust#2624)

obs-rust#2678 removed the global -Wno-missing-prototypes/-Wno-strict-prototypes pins and
fixed the first-party C they had been hiding, but two clang-only entries stayed:
libobs-opengl's target option and the macOS PUBLIC list for libobs-objects and
libobs. This drops both so AppleClang/Clang compile first-party C at the rule
like gcc already does. -Wno-shorten-64-to-32 stays: it is a different diagnostic
and out of this issue's scope.

RED: with the pins present the macOS app lane cannot report a strict-prototype
finding at all for these targets (the warning is disabled for exactly the TUs
that carry the macOS/Objective-C sources). GREEN: the same lane compiles those
TUs with -Wstrict-prototypes live; the finding list from its compile log is the
evidence and the follow-up fixes ride in this branch once macOS reports them.

Refs obs-rust#2624

* style(cmake): gersemi after the pin drop (obs-rust#2624)
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.

2 participants