clang-format: re-format for clang-18
clang-format-18 isn't compatible with the clang-format-17 output, so we
need to reformat the code with the latest version. The way clang-18
handles lambda formatting also changed, so we have made changes to the
organization default style format to better handle lambda formatting.
See I5e08687e696dd240402a2780158664b7113def0e for updated style.
See Iea0776aaa7edd483fa395e23de25ebf5a6288f71 for clang-18 enablement.
Change-Id: Ifde3559d938c6ae4718c59782af9c859b1727dc3
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/.clang-format b/.clang-format
index d43e884..28e3328 100644
--- a/.clang-format
+++ b/.clang-format
@@ -87,7 +87,7 @@
IndentWrappedFunctionNames: true
InsertNewlineAtEOF: true
KeepEmptyLinesAtTheStartOfBlocks: false
-LambdaBodyIndentation: OuterScope
+LambdaBodyIndentation: Signature
LineEnding: LF
MacroBlockBegin: ''
MacroBlockEnd: ''
@@ -98,13 +98,14 @@
ObjCSpaceBeforeProtocolList: true
PackConstructorInitializers: BinPack
PenaltyBreakAssignment: 25
-PenaltyBreakBeforeFirstCallParameter: 19
+PenaltyBreakBeforeFirstCallParameter: 50
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
+PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
-PenaltyIndentedWhitespace: 0
+PenaltyIndentedWhitespace: 1
PointerAlignment: Left
QualifierAlignment: Left
ReferenceAlignment: Left
diff --git a/src/ipmiblob/blob_errors.hpp b/src/ipmiblob/blob_errors.hpp
index 78c9a66..1aecfbf 100644
--- a/src/ipmiblob/blob_errors.hpp
+++ b/src/ipmiblob/blob_errors.hpp
@@ -9,7 +9,7 @@
class BlobException : public std::exception
{
public:
- explicit BlobException(const std::string& message) : message(message){};
+ explicit BlobException(const std::string& message) : message(message) {};
virtual const char* what() const noexcept override
{
diff --git a/src/ipmiblob/blob_handler.cpp b/src/ipmiblob/blob_handler.cpp
index fb797ff..362e264 100644
--- a/src/ipmiblob/blob_handler.cpp
+++ b/src/ipmiblob/blob_handler.cpp
@@ -42,9 +42,8 @@
return std::make_unique<BlobHandler>(std::move(ipmi));
}
-std::vector<std::uint8_t>
- BlobHandler::sendIpmiPayload(BlobOEMCommands command,
- const std::vector<std::uint8_t>& payload)
+std::vector<std::uint8_t> BlobHandler::sendIpmiPayload(
+ BlobOEMCommands command, const std::vector<std::uint8_t>& payload)
{
std::vector<std::uint8_t> request, reply, bytes;
@@ -195,8 +194,8 @@
{
std::vector<std::uint8_t> payload;
- payload.reserve(sizeof(std::uint16_t) + sizeof(std::uint32_t) +
- bytes.size());
+ payload.reserve(
+ sizeof(std::uint16_t) + sizeof(std::uint32_t) + bytes.size());
auto data = reinterpret_cast<const std::uint8_t*>(&session);
std::copy(data, data + sizeof(std::uint16_t), std::back_inserter(payload));
@@ -246,8 +245,8 @@
static constexpr std::size_t blobStateSize = sizeof(meta.blob_state);
static constexpr std::size_t metaSize = sizeof(meta.size);
static constexpr std::size_t metaOffset = blobStateSize + metaSize;
- static constexpr std::size_t minRespSize = metaOffset +
- sizeof(std::uint8_t);
+ static constexpr std::size_t minRespSize =
+ metaOffset + sizeof(std::uint8_t);
std::vector<std::uint8_t> resp;
try
@@ -377,14 +376,13 @@
return false;
}
-std::vector<std::uint8_t> BlobHandler::readBytes(std::uint16_t session,
- std::uint32_t offset,
- std::uint32_t length)
+std::vector<std::uint8_t> BlobHandler::readBytes(
+ std::uint16_t session, std::uint32_t offset, std::uint32_t length)
{
std::vector<std::uint8_t> payload;
- payload.reserve(sizeof(std::uint16_t) + sizeof(std::uint32_t) +
- sizeof(std::uint32_t));
+ payload.reserve(
+ sizeof(std::uint16_t) + sizeof(std::uint32_t) + sizeof(std::uint32_t));
auto data = reinterpret_cast<const std::uint8_t*>(&session);
std::copy(data, data + sizeof(std::uint16_t), std::back_inserter(payload));
diff --git a/src/ipmiblob/blob_handler.hpp b/src/ipmiblob/blob_handler.hpp
index a9e6ef4..dddf41b 100644
--- a/src/ipmiblob/blob_handler.hpp
+++ b/src/ipmiblob/blob_handler.hpp
@@ -21,7 +21,7 @@
CreateBlobHandler(std::unique_ptr<IpmiInterface> ipmi);
explicit BlobHandler(std::unique_ptr<IpmiInterface> ipmi) :
- ipmi(std::move(ipmi)){};
+ ipmi(std::move(ipmi)) {};
~BlobHandler() = default;
BlobHandler(const BlobHandler&) = delete;
@@ -101,9 +101,8 @@
* @return the bytes returned from the ipmi interface.
* @throws BlobException.
*/
- std::vector<std::uint8_t>
- sendIpmiPayload(BlobOEMCommands command,
- const std::vector<std::uint8_t>& payload);
+ std::vector<std::uint8_t> sendIpmiPayload(
+ BlobOEMCommands command, const std::vector<std::uint8_t>& payload);
/**
* Generic blob byte writer.
diff --git a/src/ipmiblob/blob_interface.hpp b/src/ipmiblob/blob_interface.hpp
index c527fba..5326dc1 100644
--- a/src/ipmiblob/blob_interface.hpp
+++ b/src/ipmiblob/blob_interface.hpp
@@ -138,9 +138,8 @@
* @return the bytes read
* @throws BlobException on failure.
*/
- virtual std::vector<std::uint8_t> readBytes(std::uint16_t session,
- std::uint32_t offset,
- std::uint32_t length) = 0;
+ virtual std::vector<std::uint8_t> readBytes(
+ std::uint16_t session, std::uint32_t offset, std::uint32_t length) = 0;
};
} // namespace ipmiblob
diff --git a/src/ipmiblob/ipmi_errors.hpp b/src/ipmiblob/ipmi_errors.hpp
index b17db3d..92e8274 100644
--- a/src/ipmiblob/ipmi_errors.hpp
+++ b/src/ipmiblob/ipmi_errors.hpp
@@ -11,7 +11,7 @@
{
public:
IpmiException(const std::string& message, int code) :
- _message(message), _ccode(code){};
+ _message(message), _ccode(code) {};
static std::string messageFromIpmi(int cc)
{
diff --git a/src/ipmiblob/ipmi_handler.cpp b/src/ipmiblob/ipmi_handler.cpp
index dd53af5..ef9a226 100644
--- a/src/ipmiblob/ipmi_handler.cpp
+++ b/src/ipmiblob/ipmi_handler.cpp
@@ -71,9 +71,8 @@
}
}
-std::vector<std::uint8_t>
- IpmiHandler::sendPacket(std::uint8_t netfn, std::uint8_t cmd,
- std::vector<std::uint8_t>& data)
+std::vector<std::uint8_t> IpmiHandler::sendPacket(
+ std::uint8_t netfn, std::uint8_t cmd, std::vector<std::uint8_t>& data)
{
open();
diff --git a/src/ipmiblob/ipmi_handler.hpp b/src/ipmiblob/ipmi_handler.hpp
index 2564e37..1fbf5b6 100644
--- a/src/ipmiblob/ipmi_handler.hpp
+++ b/src/ipmiblob/ipmi_handler.hpp
@@ -20,7 +20,7 @@
static std::unique_ptr<IpmiInterface> CreateIpmiHandler();
explicit IpmiHandler(std::unique_ptr<internal::Sys> sys) :
- sys(std::move(sys)){};
+ sys(std::move(sys)) {};
~IpmiHandler() = default;
IpmiHandler(const IpmiHandler&) = delete;
diff --git a/test/crc_unittest.cpp b/test/crc_unittest.cpp
index d46215e..44e715c 100644
--- a/test/crc_unittest.cpp
+++ b/test/crc_unittest.cpp
@@ -27,10 +27,11 @@
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
"AAAAAAAAAAAAAAAA";
- std::vector<CrcTestVector> vectors({{"", 0x1D0F},
- {"A", 0x9479},
- {"123456789", 0xE5CC},
- {longString, 0xE938}});
+ std::vector<CrcTestVector> vectors(
+ {{"", 0x1D0F},
+ {"A", 0x9479},
+ {"123456789", 0xE5CC},
+ {longString, 0xE938}});
for (const CrcTestVector& testVector : vectors)
{