Skip to content

libobs/util: Mark the va_list printf forwarders as printf-like (-Wformat-nonliteral) - #557

Merged
zackees merged 2 commits into
masterfrom
ci/516-ratchet-format-nonliteral
Oct 13, 2026
Merged

zackees merged 2 commits into
masterfrom
ci/516-ratchet-format-nonliteral

Conversation

@zackees

@zackees zackees commented Oct 13, 2026

Copy link
Copy Markdown
Member

Part of #516, the next ratchet rung.

  • RED: STRICT_FLAGS gains -Wformat-nonliteral. It failed on every GCC/Clang target.
  • GREEN:
    • The va_list forwarders now carry format(printf, N, 0), so GCC/Clang check the format at each caller instead of warning inside the forwarder. This is stricter checking, not suppression. The forwarders are the default log and crash handlers in base.c/base-variadic.c (a local VPRINTFATTR, since the headers #undef PRINTFATTR) and dstr_vprintf/dstr_vcatf (PRINTFATTR(2, 0) in dstr.h, which also clears dstr-libc.c). MinGW uses __gnu_printf__; MSVC is a no-op.
    • oracle/base_drive.c ignores -Wformat-nonliteral: its test entry points forward formats the parity tests choose at run time.
    • blogva is deliberately not annotated: plugins forward their own formats through it, and that belongs to the CMake phase.

All five targets build clean. The local gate passed and is stamped.

The default log and crash handlers (base.c, base-variadic.c) and
dstr_vprintf/dstr_vcatf pass their format on to vsnprintf/vfprintf.
They now carry format(printf, N, 0) (a local VPRINTFATTR in the .c files,
PRINTFATTR in dstr.h), so GCC and Clang check the format at each caller
instead of warning inside the forwarder. The oracle's base_drive.c test
entry points forward formats the parity tests pick at run time, so that
file ignores -Wformat-nonliteral.

Refs #516

Local-Gate: v1 tree=b5eb3efdfcd8c1e2fd3edd004f6efae8a7ae1826 secs=536 lanes=lint:run,rust-test:run,cross:run,tier2-linux:run
Ci-Attestation: {"at":1791894783,"gate":"rust/all/fmt","host":"linux-x86_64","key":"d7687f4b341aec687849d79d1da6a2a500d87b33651dcf9012774d922c165103","lane":"lint","parents":["b40512aa50cb486cf75ae14dbced5d06b9d9f9bd"],"secs":43,"stamp":"f0dfd43f31c6b00eb9c1cf80bdae80ab","tree":"b5eb3efdfcd8c1e2fd3edd004f6efae8a7ae1826","v":1,"via":"run"}
Ci-Attestation: {"at":1791894783,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"d7687f4b341aec687849d79d1da6a2a500d87b33651dcf9012774d922c165103","lane":"lint","parents":["b40512aa50cb486cf75ae14dbced5d06b9d9f9bd"],"secs":43,"stamp":"3121312b80cce57b8c89a351460d805c","tree":"b5eb3efdfcd8c1e2fd3edd004f6efae8a7ae1826","v":1,"via":"run"}
Ci-Attestation: {"at":1791894783,"gate":"rust/x86_64-unknown-linux-gnu/test","host":"linux-x86_64","key":"05412834323eca650a87213fbb53b0842268a935c033e13c6cbad5c27691327a","lane":"rust-test","parents":["b40512aa50cb486cf75ae14dbced5d06b9d9f9bd"],"secs":178,"stamp":"587d58a516700055d0b572ded51285fe","tree":"b5eb3efdfcd8c1e2fd3edd004f6efae8a7ae1826","v":1,"via":"run"}
Ci-Attestation: {"at":1791894783,"gate":"rust/x86_64-pc-windows-msvc/clippy","host":"linux-x86_64","key":"81bf23adc02439627ae71cc5db79049cd86440c6b9038cc32bf15ca0ba603bc7","lane":"cross","parents":["b40512aa50cb486cf75ae14dbced5d06b9d9f9bd"],"secs":194,"stamp":"8b40f72313676d684ec14e5d3ea14469","tree":"b5eb3efdfcd8c1e2fd3edd004f6efae8a7ae1826","v":1,"via":"run"}
Ci-Attestation: {"at":1791894783,"gate":"rust/x86_64-pc-windows-msvc/dylint","host":"linux-x86_64","key":"81bf23adc02439627ae71cc5db79049cd86440c6b9038cc32bf15ca0ba603bc7","lane":"cross","parents":["b40512aa50cb486cf75ae14dbced5d06b9d9f9bd"],"secs":194,"stamp":"e157651362ca029312e57d0bc3695872","tree":"b5eb3efdfcd8c1e2fd3edd004f6efae8a7ae1826","v":1,"via":"run"}
Ci-Attestation: {"at":1791894783,"gate":"rust/aarch64-apple-darwin/clippy","host":"linux-x86_64","key":"81bf23adc02439627ae71cc5db79049cd86440c6b9038cc32bf15ca0ba603bc7","lane":"cross","parents":["b40512aa50cb486cf75ae14dbced5d06b9d9f9bd"],"secs":194,"stamp":"b5476a25b5d287095f951079f7a332c8","tree":"b5eb3efdfcd8c1e2fd3edd004f6efae8a7ae1826","v":1,"via":"run"}
Ci-Attestation: {"at":1791894783,"gate":"rust/aarch64-apple-darwin/dylint","host":"linux-x86_64","key":"81bf23adc02439627ae71cc5db79049cd86440c6b9038cc32bf15ca0ba603bc7","lane":"cross","parents":["b40512aa50cb486cf75ae14dbced5d06b9d9f9bd"],"secs":194,"stamp":"46023b8e31a13e1ec78937c583106b79","tree":"b5eb3efdfcd8c1e2fd3edd004f6efae8a7ae1826","v":1,"via":"run"}
Ci-Attestation: {"at":1791894783,"gate":"rust/x86_64-apple-darwin/clippy","host":"linux-x86_64","key":"81bf23adc02439627ae71cc5db79049cd86440c6b9038cc32bf15ca0ba603bc7","lane":"cross","parents":["b40512aa50cb486cf75ae14dbced5d06b9d9f9bd"],"secs":194,"stamp":"f41bfebe99da665b8434a5d323334481","tree":"b5eb3efdfcd8c1e2fd3edd004f6efae8a7ae1826","v":1,"via":"run"}
Ci-Attestation: {"at":1791894783,"gate":"rust/x86_64-apple-darwin/dylint","host":"linux-x86_64","key":"81bf23adc02439627ae71cc5db79049cd86440c6b9038cc32bf15ca0ba603bc7","lane":"cross","parents":["b40512aa50cb486cf75ae14dbced5d06b9d9f9bd"],"secs":194,"stamp":"79d4006212e30f0ddd230c09315ede59","tree":"b5eb3efdfcd8c1e2fd3edd004f6efae8a7ae1826","v":1,"via":"run"}
Ci-Attestation: {"at":1791894783,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"301b713ea3920763713376e327a8078a3368ad9745c00ea54e97ef1f6282a692","lane":"tier2-linux","parents":["b40512aa50cb486cf75ae14dbced5d06b9d9f9bd"],"secs":121,"stamp":"a9d48ac707f3eefb96adc70101a3521d","tree":"b5eb3efdfcd8c1e2fd3edd004f6efae8a7ae1826","v":1,"via":"run"}
@zackees
zackees merged commit 1936f2b into master Oct 13, 2026
19 checks passed
@zackees
zackees deleted the ci/516-ratchet-format-nonliteral 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

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant