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: I23c72085a3819d1036e1b926ed47ef80dfde924c
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/inc/post_code.hpp b/inc/post_code.hpp
index f146008..26b5c48 100644
--- a/inc/post_code.hpp
+++ b/inc/post_code.hpp
@@ -65,8 +65,8 @@
{
PostCode(sdbusplus::bus_t& bus, const char* path, EventPtr& event,
int nodeIndex) :
- sdbusplus::server::object_t<post_code, delete_all>(bus, path),
- bus(bus), event(event), node(nodeIndex),
+ sdbusplus::server::object_t<post_code, delete_all>(bus, path), bus(bus),
+ event(event), node(nodeIndex),
postCodeListPath(PostCodeListPathPrefix + std::to_string(node)),
propertiesChangedSignalRaw(
bus,
@@ -74,47 +74,49 @@
PostCodePath + std::to_string(node),
"xyz.openbmc_project.State.Boot.Raw"),
[this](sdbusplus::message_t& msg) {
- std::string intfName;
- std::map<std::string, std::variant<postcode_t>> msgData;
- msg.read(intfName, msgData);
- // Check if it was the Value property that changed.
- auto valPropMap = msgData.find("Value");
- if (valPropMap != msgData.end())
- {
- this->savePostCodes(std::get<postcode_t>(valPropMap->second));
- }
- }),
+ std::string intfName;
+ std::map<std::string, std::variant<postcode_t>> msgData;
+ msg.read(intfName, msgData);
+ // Check if it was the Value property that changed.
+ auto valPropMap = msgData.find("Value");
+ if (valPropMap != msgData.end())
+ {
+ this->savePostCodes(
+ std::get<postcode_t>(valPropMap->second));
+ }
+ }),
propertiesChangedSignalCurrentHostState(
bus,
sdbusplus::bus::match::rules::propertiesChanged(
HostStatePathPrefix + std::to_string(node),
"xyz.openbmc_project.State.Host"),
[this](sdbusplus::message_t& msg) {
- std::string intfName;
- std::map<std::string, std::variant<std::string>> msgData;
- msg.read(intfName, msgData);
- // Check if it was the Value property that changed.
- auto valPropMap = msgData.find("CurrentHostState");
- if (valPropMap != msgData.end())
- {
- StateServer::Host::HostState currentHostState =
- StateServer::Host::convertHostStateFromString(
- std::get<std::string>(valPropMap->second));
- if (currentHostState == StateServer::Host::HostState::Off)
- {
- if (this->postCodes.empty())
+ std::string intfName;
+ std::map<std::string, std::variant<std::string>> msgData;
+ msg.read(intfName, msgData);
+ // Check if it was the Value property that changed.
+ auto valPropMap = msgData.find("CurrentHostState");
+ if (valPropMap != msgData.end())
{
- std::cerr << "HostState changed to OFF. Empty "
- "postcode log, keep boot cycle at "
- << this->currentBootCycleIndex << std::endl;
+ StateServer::Host::HostState currentHostState =
+ StateServer::Host::convertHostStateFromString(
+ std::get<std::string>(valPropMap->second));
+ if (currentHostState == StateServer::Host::HostState::Off)
+ {
+ if (this->postCodes.empty())
+ {
+ std::cerr
+ << "HostState changed to OFF. Empty "
+ "postcode log, keep boot cycle at "
+ << this->currentBootCycleIndex << std::endl;
+ }
+ else
+ {
+ this->postCodes.clear();
+ }
+ }
}
- else
- {
- this->postCodes.clear();
- }
- }
- }
- })
+ })
{
phosphor::logging::log<phosphor::logging::level::INFO>(
"PostCode is created");
diff --git a/src/post_code.cpp b/src/post_code.cpp
index 957c7ba..037f293 100644
--- a/src/post_code.cpp
+++ b/src/post_code.cpp
@@ -76,8 +76,9 @@
{
if (!timer)
{
- timer = std::make_unique<sdbusplus::Timer>(
- event.get(), [this]() { serialize(postCodeListPath); });
+ timer = std::make_unique<sdbusplus::Timer>(event.get(), [this]() {
+ serialize(postCodeListPath);
+ });
}
// steady_clock is a monotonic clock that is guaranteed to never be adjusted
@@ -114,8 +115,8 @@
if (strlen(POSTCODE_DISPLAY_PATH) > 0)
{
- std::string postCodeDisplayPath = POSTCODE_DISPLAY_PATH +
- std::to_string(node);
+ std::string postCodeDisplayPath =
+ POSTCODE_DISPLAY_PATH + std::to_string(node);
std::ofstream postCodeDisplayFile(postCodeDisplayPath);
postCodeDisplayFile << "0x" << std::setfill('0') << std::setw(2)