clang-format: copy latest and re-format
clang-format-17 has some backwards incompatible changes that require
additional settings for best compatibility and re-running the formatter.
Copy the latest .clang-format from the docs repository and reformat the
repository.
Change-Id: Ic5fd073faa7391d3f0b37787d6a9c7688c9a3253
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/.clang-format b/.clang-format
index d92a3f1..d43e884 100644
--- a/.clang-format
+++ b/.clang-format
@@ -14,26 +14,30 @@
AllowShortBlocksOnASingleLine: Empty
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Empty
-AllowShortIfStatementsOnASingleLine: false
+AllowShortIfStatementsOnASingleLine: Never
+AllowShortLambdasOnASingleLine: true
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: true
BinPackParameters: true
+BitFieldColonSpacing: None
BraceWrapping:
AfterCaseLabel: true
AfterClass: true
AfterControlStatement: true
AfterEnum: true
+ AfterExternBlock: true
AfterFunction: true
AfterNamespace: true
AfterObjCDeclaration: true
AfterStruct: true
AfterUnion: true
- AfterExternBlock: true
BeforeCatch: true
BeforeElse: true
+ BeforeLambdaBody: false
+ BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyRecord: false
@@ -48,17 +52,16 @@
ColumnLimit: 80
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
-ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
-DeriveLineEnding: false
DerivePointerAlignment: false
-PointerAlignment: Left
DisableFormat: false
-ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
-ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
+ForEachMacros:
+ - foreach
+ - Q_FOREACH
+ - BOOST_FOREACH
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^[<"](gtest|gmock)'
@@ -78,6 +81,7 @@
- Regex: '.*'
Priority: 6
IndentCaseLabels: true
+IndentExternBlock: NoIndent
IndentRequiresClause: true
IndentWidth: 4
IndentWrappedFunctionNames: true
@@ -92,6 +96,7 @@
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
+PackConstructorInitializers: BinPack
PenaltyBreakAssignment: 25
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
@@ -100,12 +105,13 @@
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PenaltyIndentedWhitespace: 0
+PointerAlignment: Left
QualifierAlignment: Left
ReferenceAlignment: Left
ReflowComments: true
RequiresClausePosition: OwnLine
RequiresExpressionIndentation: Keyword
-SortIncludes: true
+SortIncludes: CaseSensitive
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: true
@@ -117,7 +123,7 @@
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
-SpacesInAngles: false
+SpacesInAngles: Never
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
diff --git a/dbus-sdr/sdrutils.cpp b/dbus-sdr/sdrutils.cpp
index a5a82e9..3e7b966 100644
--- a/dbus-sdr/sdrutils.cpp
+++ b/dbus-sdr/sdrutils.cpp
@@ -61,8 +61,8 @@
static constexpr const int32_t depth = 2;
- auto lbdUpdateSensorTree =
- [&dbus](const char* path, const auto& interfaces) {
+ auto lbdUpdateSensorTree = [&dbus](const char* path,
+ const auto& interfaces) {
auto mapperCall = dbus->new_method_call(
"xyz.openbmc_project.ObjectMapper",
"/xyz/openbmc_project/object_mapper",
@@ -219,7 +219,7 @@
ipmi::sensor::sensors.begin(), ipmi::sensor::sensors.end(),
[&path](const ipmi::sensor::IdInfoMap::value_type& findSensor) {
return findSensor.second.sensorPath == path;
- });
+ });
}
#endif
diff --git a/dbus-sdr/sensorcommands.cpp b/dbus-sdr/sensorcommands.cpp
index 5a62d7b..ad183b7 100644
--- a/dbus-sdr/sensorcommands.cpp
+++ b/dbus-sdr/sensorcommands.cpp
@@ -139,7 +139,7 @@
sdrLastAdd = std::chrono::duration_cast<std::chrono::seconds>(
std::chrono::system_clock::now().time_since_epoch())
.count();
- });
+});
static sdbusplus::bus::match_t sensorRemoved(
*getSdBus(),
@@ -151,7 +151,7 @@
sdrLastRemove = std::chrono::duration_cast<std::chrono::seconds>(
std::chrono::system_clock::now().time_since_epoch())
.count();
- });
+});
// this keeps track of deassertions for sensor event status command. A
// deasertion can only happen if an assertion was seen first.
@@ -199,7 +199,7 @@
}
}
}
- });
+});
namespace sensor
{
diff --git a/dbus-sdr/storagecommands.cpp b/dbus-sdr/storagecommands.cpp
index 1ae0de2..e784f7e 100644
--- a/dbus-sdr/storagecommands.cpp
+++ b/dbus-sdr/storagecommands.cpp
@@ -656,7 +656,7 @@
}
return true;
- });
+ });
if (entity == entities.end())
{
diff --git a/include/ipmid/message/pack.hpp b/include/ipmid/message/pack.hpp
index 30baa59..9f42494 100644
--- a/include/ipmid/message/pack.hpp
+++ b/include/ipmid/message/pack.hpp
@@ -294,7 +294,7 @@
return std::visit(
[&p](const auto& arg) {
return PackSingle<std::decay_t<decltype(arg)>>::op(p, arg);
- },
+ },
v);
}
};
diff --git a/ipmid-new.cpp b/ipmid-new.cpp
index f4951d9..1b123ed 100644
--- a/ipmid-new.cpp
+++ b/ipmid-new.cpp
@@ -384,7 +384,7 @@
log<level::INFO>("Failed interface mapping, no such name",
entry("INTERFACE=%s", name.c_str()));
}
- },
+ },
"org.freedesktop.DBus", "/", "org.freedesktop.DBus", "GetNameOwner",
name);
}
@@ -412,7 +412,7 @@
updateOwners(conn, busName);
}
}
- },
+ },
"org.freedesktop.DBus", "/org/freedesktop/DBus", "org.freedesktop.DBus",
"ListNames");
}
diff --git a/read_fru_data.cpp b/read_fru_data.cpp
index 9b8b2ca..489ea56 100644
--- a/read_fru_data.cpp
+++ b/read_fru_data.cpp
@@ -95,10 +95,9 @@
}
for (const auto& [fruId, instanceList] : frus)
{
- auto found = std::find_if(instanceList.begin(), instanceList.end(),
- [&path](const auto& iter) {
- return (iter.path == path);
- });
+ auto found = std::find_if(
+ instanceList.begin(), instanceList.end(),
+ [&path](const auto& iter) { return (iter.path == path); });
if (found != instanceList.end())
{
diff --git a/sensorhandler.cpp b/sensorhandler.cpp
index c46157c..1483456 100644
--- a/sensorhandler.cpp
+++ b/sensorhandler.cpp
@@ -165,7 +165,7 @@
// emit interfacesRemoved signal. In that case it's handled
// by sensorsOwnerMatch
sensorCacheMap[id].reset();
- }));
+ }));
sensorUpdatedMatches.emplace(
s.first, std::make_unique<sdbusplus::bus::match_t>(
bus,
@@ -189,30 +189,30 @@
{
sensorCacheMap[s.first].reset();
}
- }));
+ }));
}
sensorsOwnerMatch = std::make_unique<sdbusplus::bus::match_t>(
bus, nameOwnerChanged(), [](auto& msg) {
- std::string name;
- std::string oldOwner;
- std::string newOwner;
- msg.read(name, oldOwner, newOwner);
+ std::string name;
+ std::string oldOwner;
+ std::string newOwner;
+ msg.read(name, oldOwner, newOwner);
- if (!name.empty() && newOwner.empty())
+ if (!name.empty() && newOwner.empty())
+ {
+ // The service exits
+ const auto it = serviceToIdMap.find(name);
+ if (it == serviceToIdMap.end())
{
- // The service exits
- const auto it = serviceToIdMap.find(name);
- if (it == serviceToIdMap.end())
- {
- return;
- }
- for (const auto& id : it->second)
- {
- // Invalidate cache
- sensorCacheMap[id].reset();
- }
+ return;
}
- });
+ for (const auto& id : it->second)
+ {
+ // Invalidate cache
+ sensorCacheMap[id].reset();
+ }
+ }
+ });
}
#endif
diff --git a/sensorhandler.hpp b/sensorhandler.hpp
index f7adb80..6e19666 100644
--- a/sensorhandler.hpp
+++ b/sensorhandler.hpp
@@ -111,7 +111,7 @@
// raw value for this call.
inline bool get_count(void* req)
{
- return (bool)((uint64_t)(req)&1);
+ return (bool)((uint64_t)(req) & 1);
}
} // namespace request
} // namespace get_sdr_info
diff --git a/test/message/payload.cpp b/test/message/payload.cpp
index 5931694..0114e11 100644
--- a/test/message/payload.cpp
+++ b/test/message/payload.cpp
@@ -317,20 +317,18 @@
extern "C"
{
- int sd_journal_send(const char* format, ...)
- {
- logs.push_back(format);
- return 0;
- }
+int sd_journal_send(const char* format, ...)
+{
+ logs.push_back(format);
+ return 0;
+}
- int sd_journal_send_with_location(const char* /*file*/,
- const char* /*line*/,
- const char* /*func*/, const char* format,
- ...)
- {
- logs.push_back(format);
- return 0;
- }
+int sd_journal_send_with_location(const char* /*file*/, const char* /*line*/,
+ const char* /*func*/, const char* format, ...)
+{
+ logs.push_back(format);
+ return 0;
+}
}
class PayloadLogging : public testing::Test
diff --git a/user_channel/channel_mgmt.cpp b/user_channel/channel_mgmt.cpp
index a179b37..2d492e0 100644
--- a/user_channel/channel_mgmt.cpp
+++ b/user_channel/channel_mgmt.cpp
@@ -355,7 +355,7 @@
std::string path = msg.get_path();
msg.read(iface, props);
processChAccessPropChange(path, props);
- });
+ });
signalHndlrObjectState = true;
chInterfaceAddedSignal = std::make_unique<sdbusplus::bus::match_t>(
diff --git a/user_channel/user_layer.hpp b/user_channel/user_layer.hpp
index 8258f6b..ad215e3 100644
--- a/user_channel/user_layer.hpp
+++ b/user_channel/user_layer.hpp
@@ -50,18 +50,18 @@
struct PrivAccess
{
#if BYTE_ORDER == LITTLE_ENDIAN
- uint8_t privilege : 4;
- uint8_t ipmiEnabled : 1;
- uint8_t linkAuthEnabled : 1;
- uint8_t accessCallback : 1;
- uint8_t reserved : 1;
+ uint8_t privilege:4;
+ uint8_t ipmiEnabled:1;
+ uint8_t linkAuthEnabled:1;
+ uint8_t accessCallback:1;
+ uint8_t reserved:1;
#endif
#if BYTE_ORDER == BIG_ENDIAN
- uint8_t reserved : 1;
- uint8_t accessCallback : 1;
- uint8_t linkAuthEnabled : 1;
- uint8_t ipmiEnabled : 1;
- uint8_t privilege : 4;
+ uint8_t reserved:1;
+ uint8_t accessCallback:1;
+ uint8_t linkAuthEnabled:1;
+ uint8_t ipmiEnabled:1;
+ uint8_t privilege:4;
#endif
} __attribute__((packed));
diff --git a/user_channel/user_mgmt.cpp b/user_channel/user_mgmt.cpp
index 017b8f6..4ec61d5 100644
--- a/user_channel/user_mgmt.cpp
+++ b/user_channel/user_mgmt.cpp
@@ -1664,7 +1664,7 @@
sdbusplus::bus::match::rules::path(userMgrObjBasePath),
[&](sdbusplus::message_t& msg) {
userUpdatedSignalHandler(*this, msg);
- });
+ });
userMgrRenamedSignal = std::make_unique<sdbusplus::bus::match_t>(
bus,
sdbusplus::bus::match::rules::type::signal() +
@@ -1672,7 +1672,7 @@
sdbusplus::bus::match::rules::path(userMgrObjBasePath),
[&](sdbusplus::message_t& msg) {
userUpdatedSignalHandler(*this, msg);
- });
+ });
userPropertiesSignal = std::make_unique<sdbusplus::bus::match_t>(
bus,
sdbusplus::bus::match::rules::type::signal() +
@@ -1683,7 +1683,7 @@
sdbusplus::bus::match::rules::argN(0, usersInterface),
[&](sdbusplus::message_t& msg) {
userUpdatedSignalHandler(*this, msg);
- });
+ });
signalHndlrObject = true;
}
std::map<DbusUserObjPath, DbusUserObjValue> managedObjs;
diff --git a/whitelist-filter.cpp b/whitelist-filter.cpp
index 6a2b4f0..cb0d4eb 100644
--- a/whitelist-filter.cpp
+++ b/whitelist-filter.cpp
@@ -115,7 +115,7 @@
log<level::INFO>((restrictMode ? "Set restrictedMode = true"
: "Set restrictedMode = false"));
- },
+ },
restrictionModeService, restrictionModeSetting,
"org.freedesktop.DBus.Properties", "Get", restrictionModeIntf,
"RestrictionMode");
@@ -211,8 +211,8 @@
modeChangeMatch = std::make_unique<sdbusplus::bus::match_t>(
*bus, filterStr, [this, deviceList](sdbusplus::message_t& m) {
- handleRestrictedModeChange(m, deviceList);
- });
+ handleRestrictedModeChange(m, deviceList);
+ });
}
/** @brief Filter IPMI messages with RestrictedMode