[PATCH 0/2] vsprintf: Use __diag macros to disable '-Wsuggest-attribute=format'

From: Nathan Chancellor
Date: Fri Apr 04 2025 - 18:10:24 EST


Hi all,

This is a follow up to the complaint that Linus made at [1] about how
the #pragma and #ifdef to disable -Wsuggest-attribute=format is
currently ugly. Convert the #pragma and #ifdef to the existing __diag()
infrastructure in the kernel to hide some of the ugliness.

I am sending it to both the vsprintf maintainers/reviewers and Linus, in
case he wants to apply it himself (since it is pretty simple).

[1]: https://lore.kernel.org/CAHk-=wgfX9nBGE0Ap9GjhOy7Mn=RSy=rx0MvqfYFFDx31KJXqQ@xxxxxxxxxxxxxx/

---
Nathan Chancellor (2):
compiler-gcc.h: Introduce __diag_GCC_all
vsprintf: Use __diag macros to disable '-Wsuggest-attribute=format'

include/linux/compiler-gcc.h | 2 ++
lib/vsprintf.c | 9 ++++-----
2 files changed, 6 insertions(+), 5 deletions(-)
---
base-commit: 9554264e302cccf4c2a1e9972f2e707b09ef74fd
change-id: 20250404-vsprintf-convert-pragmas-to-__diag-df7a84851853

Best regards,
--
Nathan Chancellor <nathan@xxxxxxxxxx>