[PATCH] D149280: [clang-tidy] Add modernize-printf-to-std-print check

Piotr Zegar via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 26 13:58:52 PDT 2023


PiotrZSL added a comment.

In D149280#4450418 <https://reviews.llvm.org/D149280#4450418>, @mikecrowe wrote:

> Despite the fact that I've worked on what became this check for about two years, now that it's landed I've suddenly spotted a significant flaw: `printf` returns the number of characters printed, whereas `std::print` doesn't return anything. None of my test cases made use of the return value. I think this means that I need to only match on calls that don't make use of the return value. I shall try to do that.

You can provide warning, but without fix. But that would need to be put into documentation.
If we lucky, and there will be no issues with current version, then you can put this in separate patch.
Anyway I do not think that many project use `printf`, most probably they use `std::cout`, `fmt::format` or some other custom wrapper around something.


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