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: Ibc0976e16acb6163431698832a461e9fc7335448
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/src/associations.cpp b/src/associations.cpp
index 6042d4d..927eec1 100644
--- a/src/associations.cpp
+++ b/src/associations.cpp
@@ -516,7 +516,7 @@
return ap.first.starts_with(endpointPath + '/');
}
return false;
- });
+ });
if (a != assocs.end())
{
diff --git a/src/handler.cpp b/src/handler.cpp
index 4fef3b1..67dc541 100644
--- a/src/handler.cpp
+++ b/src/handler.cpp
@@ -19,10 +19,9 @@
// If an entry for the object path already exists, just add the
// service name and interfaces to that entry, otherwise create
// a new entry.
- auto entry = std::find_if(objectMap.begin(), objectMap.end(),
- [&objectPath](const auto& i) {
- return objectPath == i.first;
- });
+ auto entry = std::find_if(
+ objectMap.begin(), objectMap.end(),
+ [&objectPath](const auto& i) { return objectPath == i.first; });
if (entry != objectMap.end())
{
diff --git a/src/main.cpp b/src/main.cpp
index 242903b..85f0a92 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -41,7 +41,7 @@
return;
}
owners[nameOwner] = newObject;
- },
+ },
"org.freedesktop.DBus", "/", "org.freedesktop.DBus", "GetNameOwner",
newObject);
}
@@ -157,7 +157,7 @@
std::get<std::vector<Association>>(variantAssociations);
associationChanged(io, objectServer, associations, path, processName,
interfaceMap, associationMaps);
- },
+ },
processName, path, "org.freedesktop.DBus.Properties", "Get",
assocDefsInterface, assocDefsProperty);
}
@@ -248,7 +248,7 @@
}
pElement = pElement->NextSiblingElement("node");
}
- },
+ },
transaction->processName, path, "org.freedesktop.DBus.Introspectable",
"Introspect");
}
@@ -316,7 +316,7 @@
updateOwners(systemBus, nameOwners, processName);
}
}
- },
+ },
"org.freedesktop.DBus", "/org/freedesktop/DBus", "org.freedesktop.DBus",
"ListNames");
}
@@ -572,27 +572,27 @@
iface->register_method(
"GetAncestors", [&interfaceMap](std::string& reqPath,
std::vector<std::string>& interfaces) {
- return getAncestors(interfaceMap, reqPath, interfaces);
- });
+ return getAncestors(interfaceMap, reqPath, interfaces);
+ });
iface->register_method(
"GetObject", [&interfaceMap](const std::string& path,
std::vector<std::string>& interfaces) {
- return getObject(interfaceMap, path, interfaces);
- });
+ return getObject(interfaceMap, path, interfaces);
+ });
iface->register_method(
"GetSubTree", [&interfaceMap](std::string& reqPath, int32_t depth,
std::vector<std::string>& interfaces) {
- return getSubTree(interfaceMap, reqPath, depth, interfaces);
- });
+ return getSubTree(interfaceMap, reqPath, depth, interfaces);
+ });
iface->register_method(
"GetSubTreePaths",
[&interfaceMap](std::string& reqPath, int32_t depth,
std::vector<std::string>& interfaces) {
return getSubTreePaths(interfaceMap, reqPath, depth, interfaces);
- });
+ });
iface->register_method(
"GetAssociatedSubTree",
@@ -602,7 +602,7 @@
return getAssociatedSubTree(interfaceMap, associationMaps,
associationPath, reqPath, depth,
interfaces);
- });
+ });
iface->register_method(
"GetAssociatedSubTreePaths",
@@ -612,7 +612,7 @@
return getAssociatedSubTreePaths(interfaceMap, associationMaps,
associationPath, reqPath, depth,
interfaces);
- });
+ });
iface->initialize();
diff --git a/src/processing.cpp b/src/processing.cpp
index 9b6e636..f0fcd94 100644
--- a/src/processing.cpp
+++ b/src/processing.cpp
@@ -35,7 +35,7 @@
auto inSkipList = std::find_if(skipNamespaces.begin(), skipNamespaces.end(),
[&processName](auto prefix) {
return processName.starts_with(prefix);
- }) != skipNamespaces.end();
+ }) != skipNamespaces.end();
return !(inSkipList || processName.empty());
}
diff --git a/src/test/associations.cpp b/src/test/associations.cpp
index fca0ee1..62aefab 100644
--- a/src/test/associations.cpp
+++ b/src/test/associations.cpp
@@ -499,10 +499,9 @@
ASSERT_EQ(associationData.size(), 2);
{
- auto ad = std::find_if(associationData.begin(), associationData.end(),
- [](const auto& ad) {
- return std::get<0>(ad) == "ownerA";
- });
+ auto ad = std::find_if(
+ associationData.begin(), associationData.end(),
+ [](const auto& ad) { return std::get<0>(ad) == "ownerA"; });
ASSERT_NE(ad, associationData.end());
auto& a = std::get<1>(*ad);
@@ -511,10 +510,9 @@
ASSERT_EQ(std::get<2>(a), "pathA");
}
{
- auto ad = std::find_if(associationData.begin(), associationData.end(),
- [](const auto& ad) {
- return std::get<0>(ad) == "ownerB";
- });
+ auto ad = std::find_if(
+ associationData.begin(), associationData.end(),
+ [](const auto& ad) { return std::get<0>(ad) == "ownerB"; });
ASSERT_NE(ad, associationData.end());
auto& a = std::get<1>(*ad);
diff --git a/src/test/handler.cpp b/src/test/handler.cpp
index aad6c8a..3671977 100644
--- a/src/test/handler.cpp
+++ b/src/test/handler.cpp
@@ -80,10 +80,9 @@
}));
ASSERT_EQ(interfaceMaps.size(), 1);
- auto entry = std::find_if(interfaceMaps.begin(), interfaceMaps.end(),
- [](const auto& i) {
- return "test_object_path" == i.first;
- });
+ auto entry = std::find_if(
+ interfaceMaps.begin(), interfaceMaps.end(),
+ [](const auto& i) { return "test_object_path" == i.first; });
ASSERT_NE(entry, interfaceMap.end());
for (const auto& [_, interfaces] : entry->second)
{
@@ -98,10 +97,9 @@
addObjectMapResult(interfaceMaps, "test_object_path",
std::pair<std::string, InterfaceNames>(
"test_object_connection_1", {"test_interface_2"}));
- entry = std::find_if(interfaceMaps.begin(), interfaceMaps.end(),
- [](const auto& i) {
- return "test_object_path" == i.first;
- });
+ entry = std::find_if(
+ interfaceMaps.begin(), interfaceMaps.end(),
+ [](const auto& i) { return "test_object_path" == i.first; });
ASSERT_NE(entry, interfaceMaps.end());
for (const auto& [_, interfaces] : entry->second)
{