Repository navigation
libobs/util: Mark the va_list printf forwarders as printf-like (-Wformat-nonliteral) - #557
Merged
Merged
Conversation
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"}
This was referenced Oct 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #516, the next ratchet rung.
STRICT_FLAGSgains-Wformat-nonliteral. It failed on every GCC/Clang target.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 inbase.c/base-variadic.c(a localVPRINTFATTR, since the headers#undef PRINTFATTR) anddstr_vprintf/dstr_vcatf(PRINTFATTR(2, 0)indstr.h, which also clearsdstr-libc.c). MinGW uses__gnu_printf__; MSVC is a no-op.oracle/base_drive.cignores-Wformat-nonliteral: its test entry points forward formats the parity tests choose at run time.blogvais 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.