[PATCH] D149280: [clang-tidy] Add modernize-printf-to-std-print check
Mike Crowe via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Apr 30 07:33:23 PDT 2023
mikecrowe marked 4 inline comments as done.
mikecrowe added inline comments.
================
Comment at: clang-tools-extra/docs/clang-tidy/checks/modernize/printf-to-std-print.rst:61
+- any arguments where the format string and the parameter differ in
+ signedness will be wrapped in an approprate ``static_cast``. For example,
+ given ``int i = 42``, then ``printf("%u\n", i)`` will become
----------------
njames93 wrote:
> Perhaps these conversions should only be done in StrictMode
I think that's probably a good idea. The casts are ugly, and probably unnecessary in many cases. I've implemented it, but I'm currently wrestling with the lit tests for it.
================
Comment at: clang-tools-extra/docs/clang-tidy/checks/modernize/printf-to-std-print.rst:73
+ printf-style format string and the arguments to be formatted follow
+ immediately afterwards.
+
----------------
Eugene.Zelenko wrote:
> mikecrowe wrote:
> > Eugene.Zelenko wrote:
> > > Please add information about default value.
> > The current implementation always "fixes" `printf`, `fprintf`, `absl::PrintF` and `absl::FPrintf`, even when this option is used (see `UseStdPrintCheck` constructor.) Should the option inhibit this default?
> It may be reasonable to provide possibility to override default.
I think it's likely that anyone using a custom value for either `PrintfLikeFunctions` or `FPrintfLikeFunctions` won't want the default function list for either.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D149280/new/
https://reviews.llvm.org/D149280
More information about the cfe-commits
mailing list