Skip to content

build: Add -Wundef to the GCC and Clang C options - #595

Merged
zackees merged 2 commits into
masterfrom
ci/516-wundef
Oct 13, 2026
Merged

zackees merged 2 commits into
masterfrom
ci/516-wundef

Conversation

@zackees

@zackees zackees commented Oct 13, 2026

Copy link
Copy Markdown
Member

Phase 2 of #516: the first CMake-build ratchet.

  • RED: -Wundef in the GCC (Linux) and Clang C options.
  • GREEN: every #if on a macro that can be undefined is fixed:
    • platform macros use defined();
    • build options defined only when on (HAVE_UDEV, ENABLE_HEVC, ENABLE_FFMPEG_LOGGING) use #ifdef;
    • the rest keep their value behind defined();
    • DEBUG_ASYNC_FRAMES defaults to 0, like DEBUG_AUDIO.
      SWIG-generated wrappers (obspython, obslua and the cmocka scripting tests) get -Wno-undef.

Tier 2 (Linux, warnings as errors, ENABLE_RUST_LIBOBS OFF and ON) builds clean, and the local gate is stamped. ci-full is set so the macOS, Windows and full Linux builds check the platform-specific sites.

Refs #516

An undefined macro in #if evaluates to 0, which -Wundef reports. Platform
macros use defined(); build options defined only when on (HAVE_UDEV,
ENABLE_HEVC, ENABLE_FFMPEG_LOGGING) use #ifdef; the rest keep their value
behind defined(). DEBUG_ASYNC_FRAMES defaults to 0 like DEBUG_AUDIO.

Refs #516

Local-Gate: v1 tree=4c2bf1ab38519daf9b9365685827b7f1b52db772 secs=284 lanes=lint:run,rust-test:run,cross:run,tier2-linux:run
Ci-Attestation: {"at":1791906763,"gate":"rust/all/fmt","host":"linux-x86_64","key":"11b8e8d261c0f88a97a70ed1fa938ecbd9e9152834dee50077bb2aca2fc83c65","lane":"lint","parents":["103d467ff0b5a3e7cff0e0696678bfa595f10e97"],"secs":16,"stamp":"fc6b735e08aa03749d010dd13afb066d","tree":"4c2bf1ab38519daf9b9365685827b7f1b52db772","v":1,"via":"run"}
Ci-Attestation: {"at":1791906763,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"11b8e8d261c0f88a97a70ed1fa938ecbd9e9152834dee50077bb2aca2fc83c65","lane":"lint","parents":["103d467ff0b5a3e7cff0e0696678bfa595f10e97"],"secs":16,"stamp":"d1c3ddb526fae5ff8c16e56b7e9be034","tree":"4c2bf1ab38519daf9b9365685827b7f1b52db772","v":1,"via":"run"}
Ci-Attestation: {"at":1791906763,"gate":"rust/x86_64-unknown-linux-gnu/test","host":"linux-x86_64","key":"fd65307851e81c1abe84362f96580046f38df60df9b2fbf0472a30df70f957a2","lane":"rust-test","parents":["103d467ff0b5a3e7cff0e0696678bfa595f10e97"],"secs":82,"stamp":"ba943751fbd6d6479d587940b1ac7aee","tree":"4c2bf1ab38519daf9b9365685827b7f1b52db772","v":1,"via":"run"}
Ci-Attestation: {"at":1791906763,"gate":"rust/x86_64-pc-windows-msvc/clippy","host":"linux-x86_64","key":"ed6ca487742da4b00863a57a5423177e496e5ae5f45dc43f0e4ebdd149f2f905","lane":"cross","parents":["103d467ff0b5a3e7cff0e0696678bfa595f10e97"],"secs":67,"stamp":"ac966774b61f301b36c46f680ced31dc","tree":"4c2bf1ab38519daf9b9365685827b7f1b52db772","v":1,"via":"run"}
Ci-Attestation: {"at":1791906763,"gate":"rust/x86_64-pc-windows-msvc/dylint","host":"linux-x86_64","key":"ed6ca487742da4b00863a57a5423177e496e5ae5f45dc43f0e4ebdd149f2f905","lane":"cross","parents":["103d467ff0b5a3e7cff0e0696678bfa595f10e97"],"secs":67,"stamp":"5350fd58bb566c6548f370d54f5f4d01","tree":"4c2bf1ab38519daf9b9365685827b7f1b52db772","v":1,"via":"run"}
Ci-Attestation: {"at":1791906763,"gate":"rust/aarch64-apple-darwin/clippy","host":"linux-x86_64","key":"ed6ca487742da4b00863a57a5423177e496e5ae5f45dc43f0e4ebdd149f2f905","lane":"cross","parents":["103d467ff0b5a3e7cff0e0696678bfa595f10e97"],"secs":67,"stamp":"d670b397a23900f256883fb46279d8ec","tree":"4c2bf1ab38519daf9b9365685827b7f1b52db772","v":1,"via":"run"}
Ci-Attestation: {"at":1791906763,"gate":"rust/aarch64-apple-darwin/dylint","host":"linux-x86_64","key":"ed6ca487742da4b00863a57a5423177e496e5ae5f45dc43f0e4ebdd149f2f905","lane":"cross","parents":["103d467ff0b5a3e7cff0e0696678bfa595f10e97"],"secs":67,"stamp":"8c63ef2838d7798c5be52156ba7fc036","tree":"4c2bf1ab38519daf9b9365685827b7f1b52db772","v":1,"via":"run"}
Ci-Attestation: {"at":1791906763,"gate":"rust/x86_64-apple-darwin/clippy","host":"linux-x86_64","key":"ed6ca487742da4b00863a57a5423177e496e5ae5f45dc43f0e4ebdd149f2f905","lane":"cross","parents":["103d467ff0b5a3e7cff0e0696678bfa595f10e97"],"secs":67,"stamp":"99e8b9ba66e387a22e30d5b6d3c30487","tree":"4c2bf1ab38519daf9b9365685827b7f1b52db772","v":1,"via":"run"}
Ci-Attestation: {"at":1791906763,"gate":"rust/x86_64-apple-darwin/dylint","host":"linux-x86_64","key":"ed6ca487742da4b00863a57a5423177e496e5ae5f45dc43f0e4ebdd149f2f905","lane":"cross","parents":["103d467ff0b5a3e7cff0e0696678bfa595f10e97"],"secs":67,"stamp":"6136d0abfeec6049f2026d8855718994","tree":"4c2bf1ab38519daf9b9365685827b7f1b52db772","v":1,"via":"run"}
Ci-Attestation: {"at":1791906763,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"9ae74927f8450e4027f14b4517b7bba8b91d91033bcb750853922f375f38c3f9","lane":"tier2-linux","parents":["103d467ff0b5a3e7cff0e0696678bfa595f10e97"],"secs":119,"stamp":"8f458916439ae245c3cddbd72016d3c4","tree":"4c2bf1ab38519daf9b9365685827b7f1b52db772","v":1,"via":"run"}
@zackees zackees added the ci-full Run every CI job on this PR, including the release-gating OBS app builds and Flatpak label Oct 13, 2026
@zackees
zackees merged commit 4593f5b into master Oct 13, 2026
24 checks passed
zackees added a commit that referenced this pull request Oct 13, 2026
Keep -Wundef (#595) next to -Wdouble-promotion.
@zackees
zackees deleted the ci/516-wundef branch October 26, 2026 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-full Run every CI job on this PR, including the release-gating OBS app builds and Flatpak

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant