[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
Thu Sep 14 07:07:41 PDT 2023


================
@@ -1350,10 +1360,17 @@ void Sema::checkFortifiedBuiltinMemoryFunction(FunctionDecl *FD,
             llvm::APSInt::getUnsigned(H.getSizeLowerBound())
                 .extOrTrunc(SizeTypeWidth);
         if (FormatSize > *SourceSize && *SourceSize != 0) {
-          DiagID = diag::warn_fortify_source_format_truncation;
-          DestinationSize = SourceSize;
-          SourceSize = FormatSize;
-          break;
----------------
hazohelet wrote:

This is intentional.
When the truncation warning was grouped under `Wfortify-source`, I thought it made sense to override the warning because there was no way to disable only one of `warn_fortify_source_size_mismatch` and the truncation warning.
Now that `Wformat-truncation` is made, I no longer think this warning should hide the `Wfortify-source` warning.

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


More information about the cfe-commits mailing list