[clang] [Sema] -Wformat: warn about C23 %b %B when not in C23 language mode (PR #126694)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 3 05:02:32 PST 2026
Daniel =?utf-8?q?RodrÃguez?= <danielrodriguez at meta.com>,
Daniel =?utf-8?q?RodrÃguez?= <danielrodriguez at meta.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/126694 at github.com>
================
@@ -10631,6 +10631,9 @@ def warn_printf_data_arg_not_used : Warning<
"data argument not used by format string">, InGroup<FormatExtraArgs>;
def warn_format_invalid_conversion : Warning<
"invalid conversion specifier '%0'">, InGroup<FormatInvalidSpecifier>;
+def warn_format_conversion_specifier_requires_c23 : Warning<
+ "conversion specifier '%0' requires a C standard library compatible with "
+ "C23; data argument may not be used by format">, InGroup<Format>;
----------------
AaronBallman wrote:
I think we should add a new diagnostic group for this -- users shouldn't have to disable *all* format warnings just to silence this one. We have an existing diagnostic group that could be reasonable (`-Wformat-invalid-specifier`), but this could also warrant its own group because `%b` is only *sometime* invalid, depending on what versions of C the standard library supports as opposed to a wholly invalid specifier which is never supported. But maybe I'm splitting hairs?
That said, I want to rope in some llvm-libc folks for their opinions on the PR in general, so CC @michaelrj-google @frobtech
https://github.com/llvm/llvm-project/pull/126694
More information about the cfe-commits
mailing list