Skip to content

build: Add -Wformat=2 to the C build - #606

Merged
zackees merged 3 commits into
masterfrom
ci/516-wformat2
Oct 13, 2026
Merged

zackees merged 3 commits into
masterfrom
ci/516-wformat2

Conversation

@zackees

@zackees zackees commented Oct 13, 2026

Copy link
Copy Markdown
Member

Refs #516. RED commit adds -Wformat=2 (GCC in cmake/linux/compilerconfig.cmake, Clang in compiler_common.cmake); GREEN commit fixes every violation.

Exemptions: test/cmocka gets GCC/Clang-only -Wno-format-nonliteral (existing tests are not edited).

Local pragmas (-Wformat-nonliteral, push/pop, GCC/Clang-guarded):

  • libobs/util/platform.c: strftime with format from the spec table
  • plugins/obs-nvenc/nvenc-helpers.c: nv_fail2 vprintf pass-through
  • plugins/mac-capture/mac-audio.c: ca_warn vcatf pass-through

Restructured:

  • shared/obs-scripting/obs-scripting-lua.c: startup_script_template / get_script_path_func are now const char[] (literal to the checker)
  • plugins/win-capture/monitor-capture.c: runtime-built format string replaced by two literal dstr_catf calls (same output)

Public header changes: none. nvenc/mac-capture/win-capture were not compiled locally (not in the Linux build); other grep'd sites there use literal formats. Verified full Linux build with scripting ON, rc=0; local gate stamped.

Refs #516

Local-Gate: v1 tree=6e4ee43d4a2f5cf4f294f6766c82406f24ecc8e8 secs=302 lanes=lint:run,rust-test:run,cross:run,tier2-linux:run
Ci-Attestation: {"at":1791914579,"gate":"rust/all/fmt","host":"linux-x86_64","key":"45e29c4517dca12072be7b62917c984dd41a94e6653ce61f44e6b86ba2db2f51","lane":"lint","parents":["1937bc30a40b12960df8a137ba8e1c5e4d164d70"],"secs":17,"stamp":"6521a8644d28b4819b61c9d3785da0ef","tree":"6e4ee43d4a2f5cf4f294f6766c82406f24ecc8e8","v":1,"via":"run"}
Ci-Attestation: {"at":1791914579,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"45e29c4517dca12072be7b62917c984dd41a94e6653ce61f44e6b86ba2db2f51","lane":"lint","parents":["1937bc30a40b12960df8a137ba8e1c5e4d164d70"],"secs":17,"stamp":"55cc1d6d2c8df347668baf77e3a14198","tree":"6e4ee43d4a2f5cf4f294f6766c82406f24ecc8e8","v":1,"via":"run"}
Ci-Attestation: {"at":1791914579,"gate":"rust/x86_64-unknown-linux-gnu/test","host":"linux-x86_64","key":"96c472de1cfe5c107a79b2ca8ae09d420334eb9bdf6402cf1dba933e958976d9","lane":"rust-test","parents":["1937bc30a40b12960df8a137ba8e1c5e4d164d70"],"secs":77,"stamp":"84c7f1f29b2d9b695526c50e3df0d812","tree":"6e4ee43d4a2f5cf4f294f6766c82406f24ecc8e8","v":1,"via":"run"}
Ci-Attestation: {"at":1791914579,"gate":"rust/x86_64-pc-windows-msvc/clippy","host":"linux-x86_64","key":"d33aaeb41b2a71fb1691117307fb60c551dbb09f65c04618b20d3668fdd08284","lane":"cross","parents":["1937bc30a40b12960df8a137ba8e1c5e4d164d70"],"secs":62,"stamp":"b4485901512bf0b61d2f12ff15f3d221","tree":"6e4ee43d4a2f5cf4f294f6766c82406f24ecc8e8","v":1,"via":"run"}
Ci-Attestation: {"at":1791914579,"gate":"rust/x86_64-pc-windows-msvc/dylint","host":"linux-x86_64","key":"d33aaeb41b2a71fb1691117307fb60c551dbb09f65c04618b20d3668fdd08284","lane":"cross","parents":["1937bc30a40b12960df8a137ba8e1c5e4d164d70"],"secs":62,"stamp":"646e436c61701578764669611f43ed1c","tree":"6e4ee43d4a2f5cf4f294f6766c82406f24ecc8e8","v":1,"via":"run"}
Ci-Attestation: {"at":1791914579,"gate":"rust/aarch64-apple-darwin/clippy","host":"linux-x86_64","key":"d33aaeb41b2a71fb1691117307fb60c551dbb09f65c04618b20d3668fdd08284","lane":"cross","parents":["1937bc30a40b12960df8a137ba8e1c5e4d164d70"],"secs":62,"stamp":"10a31cd3c88d08a92064631a40269440","tree":"6e4ee43d4a2f5cf4f294f6766c82406f24ecc8e8","v":1,"via":"run"}
Ci-Attestation: {"at":1791914579,"gate":"rust/aarch64-apple-darwin/dylint","host":"linux-x86_64","key":"d33aaeb41b2a71fb1691117307fb60c551dbb09f65c04618b20d3668fdd08284","lane":"cross","parents":["1937bc30a40b12960df8a137ba8e1c5e4d164d70"],"secs":62,"stamp":"d98873bfdc9266d1830c3e1d1d93fd67","tree":"6e4ee43d4a2f5cf4f294f6766c82406f24ecc8e8","v":1,"via":"run"}
Ci-Attestation: {"at":1791914579,"gate":"rust/x86_64-apple-darwin/clippy","host":"linux-x86_64","key":"d33aaeb41b2a71fb1691117307fb60c551dbb09f65c04618b20d3668fdd08284","lane":"cross","parents":["1937bc30a40b12960df8a137ba8e1c5e4d164d70"],"secs":62,"stamp":"222c4967de826f641af5322f94b96358","tree":"6e4ee43d4a2f5cf4f294f6766c82406f24ecc8e8","v":1,"via":"run"}
Ci-Attestation: {"at":1791914579,"gate":"rust/x86_64-apple-darwin/dylint","host":"linux-x86_64","key":"d33aaeb41b2a71fb1691117307fb60c551dbb09f65c04618b20d3668fdd08284","lane":"cross","parents":["1937bc30a40b12960df8a137ba8e1c5e4d164d70"],"secs":62,"stamp":"4c63ae050426455b23e37e8f545d00bb","tree":"6e4ee43d4a2f5cf4f294f6766c82406f24ecc8e8","v":1,"via":"run"}
Ci-Attestation: {"at":1791914579,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"936c1549013682da42682e6028f72f299cc467c8efa6776940cc2e78e8973ab1","lane":"tier2-linux","parents":["1937bc30a40b12960df8a137ba8e1c5e4d164d70"],"secs":146,"stamp":"b7a1c374c4b39e1ce74b018fdf6ce7e2","tree":"6e4ee43d4a2f5cf4f294f6766c82406f24ecc8e8","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 9b5421d into master Oct 13, 2026
24 checks passed
@zackees
zackees deleted the ci/516-wformat2 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