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: I676254e46de53409c3196128c19056b52b072430
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/ssifbridged.cpp b/ssifbridged.cpp
index 375008c..e503fe0 100644
--- a/ssifbridged.cpp
+++ b/ssifbridged.cpp
@@ -58,8 +58,8 @@
class SsifChannel
{
public:
- static constexpr size_t ssifMessageSize = ipmiSsifPayloadMax +
- sizeof(unsigned int);
+ static constexpr size_t ssifMessageSize =
+ ipmiSsifPayloadMax + sizeof(unsigned int);
size_t sizeofLenField = sizeof(unsigned int);
static constexpr uint8_t netFnShift = 2;
static constexpr uint8_t lunMask = (1 << netFnShift) - 1;
@@ -104,8 +104,7 @@
SsifChannel::SsifChannel(std::shared_ptr<boost::asio::io_context>& io,
std::shared_ptr<sdbusplus::asio::connection>& bus,
const std::string& device, bool verbose) :
- dev(*io),
- io(io), bus(bus), verbose(verbose), rspTimer(*io)
+ dev(*io), io(io), bus(bus), verbose(verbose), rspTimer(*io)
{
std::string devName(devBase);
if (!device.empty())
@@ -147,11 +146,12 @@
void SsifChannel::asyncRead()
{
- boost::asio::async_read(dev,
- boost::asio::buffer(xferBuffer, xferBuffer.size()),
- boost::asio::transfer_at_least(2),
- [this](const boost::system::error_code& ec,
- size_t rlen) { processMessage(ec, rlen); });
+ boost::asio::async_read(
+ dev, boost::asio::buffer(xferBuffer, xferBuffer.size()),
+ boost::asio::transfer_at_least(2),
+ [this](const boost::system::error_code& ec, size_t rlen) {
+ processMessage(ec, rlen);
+ });
}
int SsifChannel::showNumOfReqNotRsp() const
@@ -170,28 +170,29 @@
IpmiCmd& prevReqCmd = ssifchannel->prevReqCmd;
rsp.resize(ssifchannel->sizeofLenField + sizeof(prevReqCmd.cmd) +
sizeof(prevReqCmd.netfn) + sizeof(ccResponseNotAvailable));
- std::string msgToLog = "timeout, send response to keep host alive"
- " netfn=" +
- std::to_string(prevReqCmd.netfn) +
- " lun=" + std::to_string(prevReqCmd.lun) +
- " cmd=" + std::to_string(prevReqCmd.cmd) +
- " cc=" + std::to_string(ccResponseNotAvailable) +
- " numberOfReqNotRsp=" +
- std::to_string(ssifchannel->showNumOfReqNotRsp());
+ std::string msgToLog =
+ "timeout, send response to keep host alive"
+ " netfn=" +
+ std::to_string(prevReqCmd.netfn) +
+ " lun=" + std::to_string(prevReqCmd.lun) +
+ " cmd=" + std::to_string(prevReqCmd.cmd) +
+ " cc=" + std::to_string(ccResponseNotAvailable) +
+ " numberOfReqNotRsp=" +
+ std::to_string(ssifchannel->showNumOfReqNotRsp());
log<level::INFO>(msgToLog.c_str());
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
unsigned int* t = reinterpret_cast<unsigned int*>(rsp.data());
*t = 3;
- rsp[ssifchannel->sizeofLenField] = ((prevReqCmd.netfn + 1)
- << ssifchannel->netFnShift) |
- (prevReqCmd.lun & ssifchannel->lunMask);
+ rsp[ssifchannel->sizeofLenField] =
+ ((prevReqCmd.netfn + 1) << ssifchannel->netFnShift) |
+ (prevReqCmd.lun & ssifchannel->lunMask);
rsp[ssifchannel->sizeofLenField + 1] = prevReqCmd.cmd;
rsp[ssifchannel->sizeofLenField + 2] = ccResponseNotAvailable;
boost::system::error_code ecWr;
- size_t wlen = boost::asio::write(ssifchannel->dev, boost::asio::buffer(rsp),
- ecWr);
+ size_t wlen =
+ boost::asio::write(ssifchannel->dev, boost::asio::buffer(rsp), ecWr);
if (ecWr || wlen != rsp.size())
{
msgToLog =
@@ -358,8 +359,8 @@
bus->async_method_call_timed(
[this](const boost::system::error_code& ec,
const IpmiDbusRspType& response) {
- afterMethodCall(ec, response);
- },
+ afterMethodCall(ec, response);
+ },
ipmiQueueService, ipmiQueuePath, ipmiQueueIntf, ipmiQueueMethod,
dbusTimeout, netfn, lun, cmd, data, options);
}