https://github.com/MainakSil created https://github.com/llvm/llvm-project/pull/108805
Updated the example in the `StrictMode` section of the clang-tidy check `modernize-use-std-print`. The previous example incorrectly swapped the cast of signed and unsigned integers. Specifically: - The signed integer `i` was being cast to `unsigned int`, and - The unsigned integer `u` was being cast to `int`. This correction ensures that the behavior of `std::print` with `StrictMode` enabled matches that of `printf`, by reversing the casts to maintain the correct signedness. Issue Refference It solves #101397 >From 20b262e9954ec1505b1be4ea3cc362b2a9955bb9 Mon Sep 17 00:00:00 2001 From: Mainak Sil <mainaks...@gmail.com> Date: Sun, 15 Sep 2024 22:03:43 +0530 Subject: [PATCH 1/2] [docs][clang-tidy] Correct StrictMode example in modernize-use-std-print --- .../docs/clang-tidy/checks/modernize/use-std-print.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang-tools-extra/docs/clang-tidy/checks/modernize/use-std-print.rst b/clang-tools-extra/docs/clang-tidy/checks/modernize/use-std-print.rst index 59bb722e2c24fc..a825cd7432a57d 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/modernize/use-std-print.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/modernize/use-std-print.rst @@ -109,7 +109,7 @@ Options .. code-block:: c++ - std::print("{} {}\n", static_cast<unsigned int>(i), static_cast<int>(u)); + std::print("{} {}\n", static_cast<int>(u), static_cast<unsigned int>(i)); to ensure that the output will continue to be the unsigned representation of `-42` and the signed representation of `0xffffffff` (often >From e64700266ecc08b23f88415036c45177a03c40c2 Mon Sep 17 00:00:00 2001 From: Mainak Sil <mainaks...@gmail.com> Date: Mon, 16 Sep 2024 14:41:49 +0530 Subject: [PATCH 2/2] [docs][clang-tidy] Correct StrictMode example in modernize-use-std-print Updated the example in the StrictMode section of the clang-tidy check modernize-use-std-print. The previous example incorrectly swapped the cast of signed and unsigned integers. Specifically: The signed integer i was being cast to unsigned int, and The unsigned integer u was being cast to int. This correction ensures that the behavior of std::print with StrictMode enabled matches that of printf, by reversing the casts to maintain the correct signedness. Issue Refference It solves #llvm#101397 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits