[clang] [clang][Sema] Stop format size estimator upon %p to adapt to linux kernel's extension (PR #65969)

Takuya Shimizu via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 12 05:36:18 PDT 2023


hazohelet wrote:

> Is there some way we can narrow the scope of this patch so we don't lose warnings for normal `snprintf`s, only for the kernel one? If we really can't tell the difference from the source code, we could move the affected warnings to a different warning group instead, so the kernel can turn them off.

Thanks for the feedback. I narrowed the scope by checking whether the next character of `%p` can be part of the kernel extended format specifier.
If people write `%pM` or a similar outside kernel, it still aborts the format size estimator and could lead to false negative. But I think it would hurt people much less because people usually put non-alphanumeric character after `%p`.

https://github.com/llvm/llvm-project/pull/65969


More information about the cfe-commits mailing list