From 26b3630b181d1093483e4d5ebe6aeeb91a6a2976 Mon Sep 17 00:00:00 2001 From: Patrick Williams Date: Wed, 10 May 2023 17:29:00 -0500 Subject: ibm-locks: shut up clang-tidy by disabling code There is code in ibm/locks that has had clang-tidy warnings disabled for a while due to multiple safety and endianness issues. The code has not been fixed in a while and with clang-16 it is unable to be exempted further. Disable it until someone who cares can fix this in the proper way. ``` ../include/ibm/locks.hpp:522:14: error: 'p' is an unsafe pointer used for buffer access [-Werror,-Wunsafe-buffer-usage] uint8_t* p = reinterpret_cast(&resourceId1); ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../include/ibm/locks.hpp:527:25: note: used in buffer access here uint8_t pPosition = p[position]; ^ ../include/ibm/locks.hpp:524:14: error: 'q' is an unsafe pointer used for buffer access [-Werror,-Wunsafe-buffer-usage] uint8_t* q = reinterpret_cast(&resourceId2); ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../include/ibm/locks.hpp:529:25: note: used in buffer access here uint8_t qPosition = q[position]; ``` Signed-off-by: Patrick Williams Change-Id: I8a7fcbed1099419ad1715c86ffcbfef20820251e --- include/ibm/locks.hpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'include/ibm') diff --git a/include/ibm/locks.hpp b/include/ibm/locks.hpp index f0e1612588..0b3165e417 100644 --- a/include/ibm/locks.hpp +++ b/include/ibm/locks.hpp @@ -514,9 +514,15 @@ inline bool Lock::isConflictRequest(const LockRequests& refLockRequestStructure) // are same, then the last comparison would be to check for the respective // bytes in the resourceid based on the segment length. -inline bool Lock::checkByte(uint64_t resourceId1, uint64_t resourceId2, - uint32_t position) +inline bool Lock::checkByte(uint64_t /*resourceId1*/, uint64_t /*resourceId2*/, + uint32_t /*position*/) { + BMCWEB_LOG_ERROR + << "This code is disabled due to clang-tidy issues that prevent CI " + "from passing."; + std::terminate(); + +#if 0 // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast) uint8_t* p = reinterpret_cast(&resourceId1); // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast) @@ -530,6 +536,7 @@ inline bool Lock::checkByte(uint64_t resourceId1, uint64_t resourceId2, BMCWEB_LOG_DEBUG << "Comparing bytes " << std::to_string(pPosition) << "," << std::to_string(qPosition); return pPosition == qPosition; +#endif } inline bool Lock::isConflictRecord(const LockRequest& refLockRecord1, -- cgit v1.2.3