Skip to content

build(cmake): Drop -Wno-missing-prototypes and -Wno-strict-prototypes #2624

Closed

Description

@zackees

Part of #516 (maximum C/C++ warning strictness). Split out because #516 is size:XL and the Definition of Ready splits an XL issue into sub-issues before it is claimed. The other four parts are linked from #516.

Gap: the pins still hide the categories this issue names. -Wno-missing-prototypes at cmake/common/compiler_common.cmake:25 and cmake/linux/compilerconfig.cmake:69; -Wno-strict-prototypes at compiler_common.cmake:56. STRICT_FLAGS in rust/obs-c-oracle/build.rs already carries the positive forms, so the C the Rust workspace builds is ahead of the CMake build here.

RED: add -Wmissing-prototypes -Wstrict-prototypes to the CMake C flag lists (or drop the -Wno-* pins) and build the Linux Tier 2 tree; the first undeclared prototype is the RED state.

Acceptance criteria:

  • The Linux and macOS CMake builds are clean with neither -Wno-missing-prototypes nor -Wno-strict-prototypes in any flag list.
  • The remaining functions are declared before use (a static declaration or a header prototype); no function is silenced with a per-file -Wno-*.
  • No regression in the -Werror behaviour: a new missing prototype fails the build.

No docs/features.md line: build tooling only.

Activity

  1. added
    infra
    ready
    P2
    size:M
    on Oct 27, 2026
  2. zackees commented on Oct 27, 2026

    @zackees
    MemberAuthor

    Claiming: build(cmake): Drop -Wno-missing-prototypes and -Wno-strict-prototypes

    Plan (one PR):

    1. RED: delete -Wno-missing-prototypes / -Wno-strict-prototypes from the CMake C flag lists (cmake/common/compiler_common.cmake:25,56, cmake/linux/compilerconfig.cmake:69) and build the Linux Tier 2 CMake tree; the first undeclared prototype is the RED state. Record the command and the first finding.
    2. GREEN: declare each remaining function before use (a static declaration or a header prototype) — no per-file -Wno-*. If the volume in one directory is large, keep the flag list as the single switch and land the fixes in this PR.
    3. Verify: Linux CMake build clean with neither pin present anywhere; ./lint; PR CI's macOS/cross lane covers the macOS half (no macOS host here).
    4. No docs/features.md line: build tooling only.
  3. zackees commented on Oct 27, 2026

    @zackees
    MemberAuthor

    Progress (branch infra/2624-missing-prototypes, pushed; no PR yet — GREEN incomplete).

    RED reproduced. With the two pins removed and the positive forms added to the C-only lists (cmake/common/compiler_common.cmake _obs_clang_c_options; cmake/linux/compilerconfig.cmake GNU C line), uv run ci/local_gate.py --lane tier2-linux (gcc 15.2) fails with 228 -Werror= findings across ~75 files:

    area findings
    test/cmocka/*.c (the C tests themselves) 97
    plugins/* (incl. vendored rnnoise 6, librtmp 5) 84
    libobs/* 35
    shared/* 11
    deps/* 1

    First reported finding: libobs/graphics/effect.c.h:20: no previous prototype for 'gs_effect_actually_destroy'.

    Done so far (88bd4a43): the eight libobs/libobs-opengl missing-prototype functions are now declared before their definition (the unity group no longer sees the prototype only from a later file), the three () definitions/declarations get (void), and the vendored-dep exemptions are extended (glad's -Wno-strict-prototypes target option gains GNU; libcaption gains -Wno-missing-prototypes beside the -Wno-strict-prototypes it already had). Re-running the lane then surfaces the 228 above.

    Question before I spend the rest of the wat: the flags are global, so they also reach the test/cmocka C tests (97 findings) and the vendored trees. Never edit an existing C test conflicts with no per-file -Wno-* if the two flags stay in the shared flag lists. Prefer:

    1. fix the C tests' own helper prototypes too (behaviour-neutral: a prototype or (void) on a test-local helper changes no assertion), or
    2. keep the flags on the product targets and leave the test/cmocka executables on the current flags?

    I'll take (1) as the default and continue on the product code unless you say otherwise — that is the reading where the acceptance ("no function is silenced") still holds.

  4. zackees commented on Oct 27, 2026

    @zackees
    MemberAuthor

    Decision needed: how the test/cmocka C tests (and vendored trees) are treated by this flag drop.

    The RED is reproduced and the direction is stuck on a genuine rule collision. Removing -Wno-missing-prototypes / -Wno-strict-prototypes from the global CMake C flag lists reaches every C translation unit, including the cmocka tests: uv run ci/local_gate.py --lane tier2-linux (gcc 15.2) then reports 228 -Werror= findings across ~75 files:

    area findings
    test/cmocka/*.c (the C tests themselves) 97
    plugins/* (incl. vendored rnnoise 6, librtmp 5) 84
    libobs/* 35
    shared/* 11
    deps/* 1

    The acceptance criteria ("no -Wno-* in any flag list", "the remaining functions are declared before use") require the 97 test findings be declared too, but that means editing an existing C test, which AGENTS.md / the worker checklist forbid ("Never edit an existing C test"). Vendored deps already have the target-scoped exemption precedent from #516 (extend those, do not touch their sources) — but a -Wno-* on the test targets would still be "in a flag list".

    Options:

    1. Fix the test helpers too (make the non-static cmocka helpers static, or declare them before use) — a behaviour-neutral edit to the test files, satisfying both acceptance criteria. This is what build(cmake): Compile C with -Wpedantic (deps/glad exempt) #2623 (-Wpedantic) already does (test/cmocka/test_audio_buffering_subsample.c, config_close_fault.c, test_graphics_host_functions.c, test_output_end_capture_thread_join.c), so it is the consistent reading; the "never edit a C test" rule reads as "don't weaken an assertion to pass a port".
    2. Exempt the cmocka test executables with target-scoped options (the build: Maximum C/C++ warning strictness with -Werror on every platform (cross-compiled with soldr) #516 vendored-dep pattern) and leave the tests unchecked — no test edit, but a -Wno-* remains in a flag list, tripping the first acceptance criterion.
    3. Scope the two positive flags to the first-party product targets only (libobs, plugins, shared) instead of the global C lists, so the test executables simply never receive them — nothing is silenced and no test is edited, at the cost of the cmocka C no longer being checked.

    My recommendation is (1): it is the only option that satisfies both acceptance criteria, it is behaviour-neutral, and it matches what this series already does for -Wpedantic. I will take it unless told otherwise — the product-code fixes are independent of this and continue either way.

    State so far: branch infra/2624-missing-prototypes is pushed. 88bd4a43 declares the eight libobs/libobs-opengl functions before their definitions, changes three () definitions to (void), and extends the vendored-dep exemptions (glad gains GNU -Wno-strict-prototypes, libcaption gains -Wno-missing-prototypes). No PR yet — GREEN is incomplete pending this decision on scope.

  5. added
    decision-needed
    claim-blocked
    on Oct 27, 2026
  6. zackees commented on Oct 27, 2026

    @zackees
    MemberAuthor

    Decided: take option 2 — exempt the test/cmocka test tree with a target-scoped option and do not edit any C test. Option 1's premise is factually wrong: #2623 does not edit test sources.

    Why not option 1. AGENTS.md:122 and .claude/skills/obs-worker/SKILL.md:120 say "Never edit existing C tests or public C headers to make a port pass." The maintainer's own in-flight PR for the sibling ratchet, #2643 (-Wpedantic, #2623), resolves the identical collision without touching a single test source: its only test/ change is test/cmocka/CMakeLists.txt, adding

    # Existing C tests are never edited to satisfy a new warning, and -Wpedantic
    # rejects the ISO-C extensions they and the vendored librtmp sources some of
    # them compile rely on ...
    add_compile_options($<$<COMPILE_LANG_AND_ID:C,AppleClang,Clang,GNU>:-Wno-pedantic>)

    #2643's full file list has no test/cmocka/*.c (the four files the issue names — test_audio_buffering_subsample.c, config_close_fault.c, test_graphics_host_functions.c, test_output_end_capture_thread_join.c — are not in it). So "the consistent reading" points the other way: the rule is absolute for a new warning, and the exemption lives in the test tree's own CMakeLists.txt.

    That mechanism already exists here. test/cmocka/CMakeLists.txt carries three of these today, each target-scoped and under the comment # Existing C tests are never edited (obs-rust/obs-studio#516).: -Wno-shadow, -Wno-cast-qual, -Wno-format-nonliteral. Adding -Wno-missing-prototypes;-Wno-strict-prototypes beside them, with a comment citing #516/#2624 and the same "existing C tests are never edited" reason, is the fourth application of the rule, not a new exception.

    How the acceptance criteria are then read (say which you did in the PR body):

    1. "no -Wno-missing-prototypes / -Wno-strict-prototypes in any flag list" means the product flag lists: cmake/common/compiler_common.cmake (_obs_clang_c_options, and the GNU C line), cmake/linux/compilerconfig.cmake, cmake/macos/compilerconfig.cmake, cmake/windows/compilerconfig.cmake. Both pins leave all of them.
    2. The only place either -Wno-* may appear afterwards is a target-scoped exemption with a comment naming the reason: test/cmocka/CMakeLists.txt (the test executables) and the vendored trees build(cmake): compile C with -Wpedantic (#2623) #2643 already exempts (deps/glad, deps/libcaption, and rnnoise/librtmp for the plugins/* findings). Extend those target options; do not edit their sources.
    3. Everything first-party stays fully checked: the libobs/*, libobs-opengl/*, shared/*, first-party plugins/* and frontend C findings are real and must be fixed with declarations before use / (void) / static, not silenced. That is the ~131 non-test findings; the work already done on infra/2624-missing-prototypes (88bd4a43) stays.
    4. Never edit an existing C test, even mechanically (no static, no forward declarations). Option 3 is rejected too: pushing the two positive flags into per-target lists makes the flag lists diverge per target and quietly stops checking any first-party target someone forgets to list.

    The two rules no longer collide: the product code gets the strict pair, the reference test tree keeps its existing exemption mechanism. This is a build-tooling change with no user-visible behaviour, so no docs/features.md line.

    Sources: AGENTS.md:122, .claude/skills/obs-worker/SKILL.md:120, #2643 (-Wpedantic, #2623) test/cmocka/CMakeLists.txt hunk, the existing -Wno-shadow/-Wno-cast-qual/-Wno-format-nonliteral lines in test/cmocka/CMakeLists.txt, #516.

    If you disagree with reading the "no -Wno-* in any flag list" criterion as product-only, say so and I will re-scope this to option 3 — the product-code fixes in 88bd4a43 are independent of it either way.

  7. 11 remaining items

  8. moved this from Needs decision to In progress in obs-rust Multiviewon Oct 27, 2026
  9. zackees commented on Oct 27, 2026

    @zackees
    MemberAuthor

    Backfill found by the dispatched Ubuntu 🐧 (OBS-Studio-Rust) lane after #2703 exempted the SWIG-generated shared/obs-scripting sources: with that target compiling again, the same lane stops in first-party code, so this is a #2678 gap rather than another generated-file case.

    Evidence

    Scheduled Repository Actions on infra/2703-scripting-missing-prototypes at ec608e33 (run 40595018476, job 122510595427):

    shared/obs-scripting: 9 C objects compiled (no diagnostics with the #2703 exemption)
    libobs-opengl/gl-wayland-egl.c.h:90:23: error: no previous prototype for 'gl_wayland_egl_windowinfo_create' [-Werror=missing-prototypes]
    ninja: build stopped: subcommand failed.
    

    gl_wayland_egl_windowinfo_create is defined at libobs-opengl/gl-wayland-egl.c.h:90 with no declaration before it in that translation unit (libobs-opengl/gl-wayland-egl.h declares the gl_windowinfo struct and gl_wayland_egl_windowinfo_destroy, not this constructor).

    Why #2678's replay missed it

    #2678's RED/GREEN evidence was a -fsyntax-only replay over the Tier 2 compdb TUs. The Ubuntu app build compiles a wider set — the Wayland EGL backend and the Qt frontend are Linux-app-only — so classes of this shape can be clean in the replay and still be red in a lane the PR CI never runs.

    Suggested shape for whoever takes it: replay the Ubuntu app build's own compdb (build_ubuntu) rather than the Tier 2 one, enumerate the whole class in one pass, and fix it as one multi-directory PR with declarations before definitions ((void) only where the definition takes no parameters); no -Wno-* and no per-file pragmas, per this issue's acceptance. Expect libobs-opengl/gl-*.c.h, the Wayland/X11 backends and Qt frontend sources to be the overlap.

    Related: #2703 (generated SWIG exemption, in flight), #2705 (Flatpak lane blocked earlier, at the flatpak-builder-lint action).

  10. zackees commented on Oct 27, 2026

    @zackees
    MemberAuthor

    Correction to the parenthetical above (I checked the headers after posting): libobs-opengl/gl-wayland-egl.h declares only gl_wayland_egl_get_winsys_vtable, and gl_wayland_egl_windowinfo_destroy is static. The minimal fix for gl_wayland_egl_windowinfo_create is to make it static too — it is referenced only by the gl_winsys_vtable initialiser in the same translation unit (gl-wayland-egl.c.h:438), and the X11 sibling already has that shape:

    libobs-opengl/gl-x11-egl.c.h:236: static struct gl_windowinfo *gl_x11_egl_windowinfo_create(const struct gs_init_data *info)
    libobs-opengl/gl-wayland-egl.c.h:90: struct gl_windowinfo *gl_wayland_egl_windowinfo_create(...)   <-- needs the same
    

    So this is a one-token fix in one file, not a declaration in a header. It still wants the class-wide sweep described above (the Ubuntu-app-only TUs are the gap in #2678's replay), but if someone wants the lane green first, this is the next single edit it will ask for.

  11. zackees commented on Oct 28, 2026

    @zackees
    MemberAuthor

    Resuming: refreshing the claim (last progress was ~19 h ago) with a re-check of what is actually left on master, because the backfill this issue carries is now partly fixed.

    Verified on master (0fada4c78)

    What this issue still owns

    The backfill's real finding was not the one file, it was the class: #2678's replay enumerated the Tier 2 compdb, while the Ubuntu app lane compiles a wider TU set (libobs-opengl Wayland/EGL, the X11 backend, Qt frontend, the Linux-only plugin targets). I have not enumerated that wider set, so I am not claiming it is clean.

    Remaining -Wno-* instances on master, classified — none of these is the global pin this issue was filed about:

    site category
    deps/glad/CMakeLists.txt:33, deps/libcaption/CMakeLists.txt:37-38 vendored
    plugins/obs-outputs/CMakeLists.txt:112 (librtmp block), plugins/obs-filters/cmake/rnnoise.cmake:58 vendored
    plugins/obs-x264/cmake/x264-test.cmake:5 test target
    libobs-opengl/CMakeLists.txt:43, libobs/cmake/os-macos.cmake:18 clang-only, target-scoped (macOS)
    rust/obs-build/src/platform/graphics_macos.rs:29 the Rust build's own macOS flag list

    Next step (this claim)

    Enumerate the Ubuntu-app-only TU class from that lane's own compdb rather than the Tier 2 one, fix any first-party missing prototype as declarations-before-definitions ((void) only for empty parameter lists, no -Wno-*, no per-file pragmas), and take the clang-only macOS entries above separately — they cannot be verified on this Linux host, so they belong in the macOS lane or a follow-up, not in a silent flag edit.

  12. zackees commented on Oct 28, 2026

    @zackees
    MemberAuthor

    The wider TU class is clean: replay evidence, no cache in the path

    The remaining item this issue owned was the class, not the one file: #2678's replay enumerated the Tier 2 compdb, while the app lane also compiles libobs-opengl, the Linux plugin targets and frontend/. A warm zccache does not key on compile flags, so a green app lane was not proof by itself.

    I replayed that wider set instead of trusting a lane.

    What was replayed. The obs-rust-linux-validate tree's own ninja -t compdb (configured 2026-10-28 07:23 UTC, RelWithDebInfo, ENABLE_BROWSER=OFF): every C translation unit in the tree — libobs (73), libobs-opengl (2 unity TUs, 276 command references), plugins (113), shared (42), plus the 413 per-target unity/generated TUs the test and app targets build — 684 TUs, against master 0fada4c78.

    docker run --rm -v obs-rust-linux-validate-build-5dd0892dd40b:/build \
      -v "$PWD":/ro:ro -v "$PWD_SCRATCH":/work -w /build/tree \
      obs-rust-linux-validate:e756cdba69646bd5 \
      uv run --no-project /ro/ci/warning_findings.py \
        --compdb /work/c2624-compdb.json --json --out /work/c2624-report.json

    ci/warning_findings.py is the right tool here for two reasons: it strips the zccache wrapper and runs -fsyntax-only, so nothing is served from the cache, and it keeps the diagnostic options as they are in the compdb — which for these TUs are the real lane flags, -Wmissing-prototypes -Wstrict-prototypes ... -Werror. A finding would therefore have printed as warning:/error: under its -W option.

    Result: {"total": 0, "translation_units": 684, "directories": [], "findings": []} — zero findings. So the wider Linux C set meets this issue's first acceptance criterion without any suppression, and that is a stronger statement than the green lane was: it did not depend on the cache.

    What is left, and it is only the clang half

    Every first-party -Wno-missing-prototypes / -Wno-strict-prototypes on master is now one of:

    site why it is not this issue's global pin
    libobs-opengl/CMakeLists.txt:43, libobs/cmake/os-macos.cmake:18, plugins/obs-x264/cmake/x264-test.cmake:5 COMPILE_LANG_AND_ID:C,AppleClang,Clang — clang-only, so a GCC Linux lane never exercises the suppressed warning
    deps/glad, deps/libcaption, plugins/obs-outputs (librtmp block), plugins/obs-filters/cmake/rnnoise.cmake vendored
    shared/obs-scripting (SWIG output) generated, exempted by #2703
    test/cmocka/CMakeLists.txt:60-61 the cmocka test tree, all compilers

    The three clang-only entries cannot be cleared from this Linux host: the replay above is GCC, and installing clang here only approximates AppleClang. They need a clang replay (or a macOS lane) and, for the two that are -Wshorten-64-to-32-adjacent on macOS, a Mac. That is the whole remainder of this issue.

    My read: the Linux acceptance criterion is met and demonstrated; the clang-only remainder is a separate, small unit that a macOS-capable session or a clang replay lane should take. Say which you want and I will file it as its own issue rather than leave it inside this one.

  13. zackees commented on Oct 28, 2026

    @zackees
    MemberAuthor

    Measured the wider set this issue still owned: the Ubuntu app lane's first-party C is clean at #2678's flags.

    The remaining item was that #2678's replay enumerated the Tier 2 compdb, while the app lane compiles a wider TU set. I enumerated that set from its own build tree rather than from Tier 2:

    uv run build-aux/appimage/build.py --steps version,configure      # manylinux base, 14 s, no compile
    ninja -t compdb > compdb-app.json                                  # in build_ubuntu/
    uv run ci/warning_findings.py --compdb compdb-app.json --root /src --json
    

    {"total": 0, "translation_units": 155, "findings": []}

    • 155 C translation units (1234 TUs total; the flags apply to the C subset), gcc 14.2, the AppImage/manylinux base — the same environment the Ubuntu 🐧 (OBS-Studio-Rust) and AppImage lanes use.
    • -Wmissing-prototypes and -Wstrict-prototypes are in every one of those flag lists; neither -Wno-missing-prototypes nor -Wno-strict-prototypes is present in a first-party list.
    • The unity groups that carry the app-only sources (opengl.nix-wayland+.h.c, opengl.nix+.h.c) are in the set, so libobs-opengl's Wayland/X11 backend is covered by the replay, not by fix(libobs-opengl): Make the Wayland windowinfo factory static (#2703) #2710 alone.
    • The only trees that still carry the pins are vendored (deps/libcaption, plugins/obs-outputs librtmp block). Re-running with --drop on both pins reports zero findings there too.

    Sanity check on the helper rather than a bare zero: replaying one TU through warning_findings.replay() directly returns rc 0, findings 0, i.e. the compiler really ran (a unit with a broken include path fails loudly instead).

    I also checked whether a source-scan test could pin this class the way ci/test_platform_missing_prototypes.py does. It cannot: a regex scan for a non-static file-scope definition with no prototype in an indexed header reports 244 candidates in libobs/ and plugins/*.c.h — their prototypes live in sibling *.c.h files the scan does not index — while the compiler reports none. Only the replay answers this, so no test is added.

    Deliverable: #2833 adds the enumeration step to the mechanical-warning rule in docs/rust-port/coordination.md, so the next pin-drop measures the app set and not just a PR lane's.

    Still open on this issue: the clang-only macOS entries (libobs-opengl/CMakeLists.txt:43, libobs/cmake/os-macos.cmake:18) cannot be verified from this Linux host. They need the same treatment measured in the macOS app lane, which is a separate dispatch, not a silent flag edit. Claim stays on this issue for that.

  14. zackees commented on Oct 28, 2026

    @zackees
    MemberAuthor

    Resuming the macOS half: #2850 (draft) drops the two clang-only -Wno-strict-prototypes entries this issue still owned — libobs-opengl/CMakeLists.txt:43 and libobs/cmake/os-macos.cmake:18 (-Wno-shorten-64-to-32 stays, different diagnostic).

    The branch is pushed as a draft on purpose: the RED is that the macOS app lane cannot report a strict-prototype finding for those targets while the warning is disabled, and the GREEN is that lane compiling the same TUs with -Wstrict-prototypes live. That log is the evidence this Linux host cannot produce by replay, so I will read Build 🧱 / macOS 🍏 from #2850's run and either record a clean list or fix what it reports in the same branch before marking it ready.

    Claim stays on this issue.

  15. moved this from In progress to Done in obs-rust Multiviewon Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P2infrareadysize:M

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions