From aa3b8d9ddba7fce8a39260f70cfde5039d96363d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Sun, 11 Aug 2024 17:58:06 +0200 Subject: [PATCH] Code cleanup: Use c++ type std::uintptr_t (#6681) --- cppcheckpremium-suppressions | 5 +---- lib/utils.h | 4 ++-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/cppcheckpremium-suppressions b/cppcheckpremium-suppressions index b86caf343e8..7ea4ec12398 100644 --- a/cppcheckpremium-suppressions +++ b/cppcheckpremium-suppressions @@ -127,7 +127,7 @@ premium-misra-cpp-2023-7.11.3 # too picky about operator precedence. premium-misra-cpp-2023-8.0.1 -# TODO use std::uintptr_t +# TODO review lambda captures premium-misra-cpp-2023-8.1.1 # TODO should we use this rule? @@ -139,9 +139,6 @@ premium-misra-cpp-2023-8.2.6 # intentional pointer to int conversion in lib/utils.h to output dump files premium-misra-cpp-2023-8.2.7:lib/utils.h -# TODO: use std::uintptr_t -premium-misra-cpp-2023-8.2.8 - # TODO check ellipsis usage premium-misra-cpp-2023-8.2.11 diff --git a/lib/utils.h b/lib/utils.h index 2f8766ae017..fb4e2b25ed0 100644 --- a/lib/utils.h +++ b/lib/utils.h @@ -322,7 +322,7 @@ static inline std::string id_string_i(std::uintptr_t l) while (l != 0) { char c; - const uintptr_t temp = l % 16; // get the remainder + const std::uintptr_t temp = l % 16; // get the remainder if (temp < 10) { // 0-9 c = '0' + temp; @@ -340,7 +340,7 @@ static inline std::string id_string_i(std::uintptr_t l) static inline std::string id_string(const void* p) { - return id_string_i(reinterpret_cast(p)); + return id_string_i(reinterpret_cast(p)); } static inline const char* bool_to_string(bool b)