Skip to content

build(cmake): Compile C with -Wpedantic (deps/glad exempt) #2623

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: -Wpedantic is in no CMake flag list — git grep Wpedantic -- cmake returns nothing. The Phase 2 C flags that did land are at cmake/linux/compilerconfig.cmake:69 (GCC C) and cmake/common/compiler_common.cmake:65-73 (clang C), with CMAKE_COMPILE_WARNING_AS_ERROR defaulting ON at compiler_common.cmake:94-95.

RED: add -Wpedantic to the C flag lists and build the Linux Tier 2 CMake tree; the first violation is the RED state.

Acceptance criteria:

  • The Linux and macOS CMake builds are clean with -Wpedantic in the C flag lists (both the GCC list and the clang list).
  • deps/glad is compiled without the flag, as an explicit target-level exemption rather than a global -Wno-pedantic; no first-party target is exempt.
  • The flag is still applied when CMAKE_COMPILE_WARNING_AS_ERROR is ON, so a new violation 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: add -Wpedantic to the CMake C flag lists (deps/glad target-exempt).

    Plan (one PR):

    1. Add -Wpedantic to the GNU and Clang C option lists (cmake/common/compiler_common.cmake, cmake/linux/compilerconfig.cmake), with deps/glad exempted at the target level (no global -Wno-pedantic, no first-party exemption).
    2. RED: build the Linux Tier 2 libobs tree with the flag added; the first -Wpedantic finding is the RED state (record path:line).
    3. GREEN: fix each finding at the source (explicit cast / widened type / the pedantic-correct form). No per-file -Wno-* and no #pragma, so a new violation still fails the build under CMAKE_COMPILE_WARNING_AS_ERROR=ON.
    4. One PR on branch infra/2623-wpedantic, Refs #2623 and Refs #516.

    Note on scope: accept criterion "Linux and macOS CMake builds clean" — this host can only build Linux; macOS is left to PR/release CI, so the PR will use Refs #2623, not Fixes.

    First PR expected within this tick.

  3. zackees commented on Oct 27, 2026

    @zackees
    MemberAuthor

    Done — PR #2643 (infra/2623-wpedantic, 4 commits, Refs #2623 + Refs #516).

    RED (survey, OBS_EXTRA_CFLAGS='-Wpedantic', warnings-as-error off): 3110 warning
    lines, of which ~200 first-party C (the rest vendored glad/libcaption/librtmp,
    generated SWIG output and system headers) — dominated by object<->function
    pointer conversions, __FUNCTION__, return with expression in a void
    function, %p on non-void *, %m, pre-C23 empty braces, a forward enum
    reference and __int128.

    GREEN (Tier 2 Docker build stage, -Wpedantic on, warnings-as-error at its
    default ON):

    == configure + build (libobs and libobs-c-reference)
    == libobs exported symbols, C vs Rust
    IDENTICAL (1766 symbols)
    RUN_DONE rc=0
    

    Zero warning: lines. ./lint green, including ci/test_build_groups.py.

    Scope notes: -Wpedantic is added to the C lists only (C++ untouched); vendored
    targets are exempted at the target/per-source level (no global -Wno-pedantic,
    no per-file -Wno-*, no #pragma), so a new first-party violation still fails
    the build. macOS is unverifiable on this host, hence Refs rather than Fixes.

  4. zackees commented on Oct 28, 2026

    @zackees
    MemberAuthor

    Closing as complete: #2643 (infra/2623-wpedantic) merged on 2026-10-27T15:48:00Z. The Tier 2 Docker build stage runs -Wpedantic on C lists only with warnings-as-error at its default ON and reports zero warning: lines; vendored targets are exempted per target/per source (no global or per-file -Wno-*, no pragmas). ./lint green including ci/test_build_groups.py. macOS remains unverified on this host, which is why the PR used Refs #2623 rather than Fixes; reopen if a macOS lane later reports a first-party pedantic violation.

  5. moved this from In progress to Done in obs-rust Multiviewon Oct 28, 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