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: Ief40c08041429a57684a6debd84eecea2a298dff
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/.clang-format b/.clang-format
index 4922cf6..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)'
@@ -93,6 +96,7 @@
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
+PackConstructorInitializers: BinPack
PenaltyBreakAssignment: 25
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
@@ -101,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
@@ -118,7 +123,7 @@
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
-SpacesInAngles: false
+SpacesInAngles: Never
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
diff --git a/src/network_manager.cpp b/src/network_manager.cpp
index 6b19704..5f4a89f 100644
--- a/src/network_manager.cpp
+++ b/src/network_manager.cpp
@@ -73,7 +73,7 @@
lg2::error("AdministrativeState match parsing failed: {ERROR}", "ERROR",
e);
}
- })
+})
{
reload.get().setCallback([self = stdplus::PinnedRef(*this)]() {
for (auto& hook : self.get().reloadPreHooks)
@@ -373,7 +373,7 @@
static_assert(std::is_same_v<stdplus::In6Addr, decltype(addr)>);
it->second.defgw6.emplace(addr);
}
- },
+ },
addr);
if (auto it = interfacesByIdx.find(ifidx); it != interfacesByIdx.end())
{
@@ -391,7 +391,7 @@
it->second->EthernetInterfaceIntf::defaultGateway6(
stdplus::toStr(addr));
}
- },
+ },
addr);
}
}
@@ -422,7 +422,7 @@
it->second.defgw6.reset();
}
}
- },
+ },
addr);
if (auto it = interfacesByIdx.find(ifidx); it != interfacesByIdx.end())
{
@@ -446,7 +446,7 @@
it->second->EthernetInterfaceIntf::defaultGateway6("");
}
}
- },
+ },
addr);
}
}
diff --git a/src/rtnetlink_server.cpp b/src/rtnetlink_server.cpp
index 4a211d5..1e3ac71 100644
--- a/src/rtnetlink_server.cpp
+++ b/src/rtnetlink_server.cpp
@@ -123,8 +123,8 @@
Server::Server(sdeventplus::Event& event, Manager& manager) :
sock(makeSock()),
io(event, sock.get(), EPOLLIN | EPOLLET, [&](auto&&... args) {
- return eventHandler(manager, std::forward<decltype(args)>(args)...);
- })
+ return eventHandler(manager, std::forward<decltype(args)>(args)...);
+})
{
auto cb = [&](const nlmsghdr& hdr, std::string_view data) {
handler(manager, hdr, data);
diff --git a/src/system_configuration.cpp b/src/system_configuration.cpp
index 7604eb9..6eb1588 100644
--- a/src/system_configuration.cpp
+++ b/src/system_configuration.cpp
@@ -44,7 +44,7 @@
{
lg2::error("Hostname match parsing failed: {ERROR}", "ERROR", e);
}
- })
+})
{
try
{
diff --git a/src/system_queries.cpp b/src/system_queries.cpp
index 00ba064..87ba4aa 100644
--- a/src/system_queries.cpp
+++ b/src/system_queries.cpp
@@ -89,7 +89,7 @@
ifname, SIOCETHTOOL, "ETHTOOL"sv,
[&](const ifreq&) {
return EthInfo{.autoneg = edata.autoneg != 0, .speed = edata.speed};
- },
+ },
&edata)
.value_or(EthInfo{});
}
diff --git a/test/test_network_manager.hpp b/test/test_network_manager.hpp
index a9a7985..e8b9fcc 100644
--- a/test/test_network_manager.hpp
+++ b/test/test_network_manager.hpp
@@ -24,8 +24,8 @@
{
EXPECT_CALL(mockReload, setCallback(testing::_))
.WillOnce([&](fu2::unique_function<void()>&& cb) {
- reloadCb = std::move(cb);
- });
+ reloadCb = std::move(cb);
+ });
return mockReload;
}
};