clang-format: copy latest and re-format
clang-format-16 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: I657f0cb5283a0b4177332d94a88af660f3de8f11
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/.clang-format b/.clang-format
index ddfe2d7..d92a3f1 100644
--- a/.clang-format
+++ b/.clang-format
@@ -6,12 +6,14 @@
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Right
-AlignOperands: true
-AlignTrailingComments: true
+AlignOperands: Align
+AlignTrailingComments:
+ Kind: Always
+ OverEmptyLines: 1
AllowAllParametersOfDeclarationOnNextLine: true
-AllowShortBlocksOnASingleLine: false
+AllowShortBlocksOnASingleLine: Empty
AllowShortCaseLabelsOnASingleLine: false
-AllowShortFunctionsOnASingleLine: None
+AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterReturnType: None
@@ -36,6 +38,7 @@
SplitEmptyFunction: false
SplitEmptyRecord: false
SplitEmptyNamespace: false
+BreakAfterAttributes: Never
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
BreakBeforeTernaryOperators: true
@@ -75,9 +78,13 @@
- Regex: '.*'
Priority: 6
IndentCaseLabels: true
+IndentRequiresClause: true
IndentWidth: 4
IndentWrappedFunctionNames: true
-KeepEmptyLinesAtTheStartOfBlocks: true
+InsertNewlineAtEOF: true
+KeepEmptyLinesAtTheStartOfBlocks: false
+LambdaBodyIndentation: OuterScope
+LineEnding: LF
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
@@ -85,13 +92,19 @@
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
+PenaltyBreakAssignment: 25
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
+PenaltyIndentedWhitespace: 0
+QualifierAlignment: Left
+ReferenceAlignment: Left
ReflowComments: true
+RequiresClausePosition: OwnLine
+RequiresExpressionIndentation: Keyword
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
@@ -111,6 +124,6 @@
SpacesInSquareBrackets: false
Standard: Latest
TabWidth: 4
-UseCRLF: false
UseTab: Never
...
+
diff --git a/association_manager.cpp b/association_manager.cpp
index 1b28ace..65897ca 100644
--- a/association_manager.cpp
+++ b/association_manager.cpp
@@ -144,18 +144,18 @@
auto interface = std::find_if(object.begin(), object.end(),
[&condition](const auto& i) {
- return i.first == condition.interface;
- });
+ return i.first == condition.interface;
+ });
if (interface == object.end())
{
continue;
}
- auto property =
- std::find_if(interface->second.begin(), interface->second.end(),
- [&condition](const auto& p) {
- return condition.property == p.first;
- });
+ auto property = std::find_if(interface->second.begin(),
+ interface->second.end(),
+ [&condition](const auto& p) {
+ return condition.property == p.first;
+ });
if (property == interface->second.end())
{
continue;
diff --git a/interface_ops.hpp b/interface_ops.hpp
index 8806fdc..eee0bd2 100644
--- a/interface_ops.hpp
+++ b/interface_ops.hpp
@@ -99,8 +99,7 @@
template <typename T, typename Enable = void>
struct AssignInterface
{
- static void op(const Interface&, std::any&, bool)
- {}
+ static void op(const Interface&, std::any&, bool) {}
};
template <typename T>
diff --git a/manager.cpp b/manager.cpp
index 2c4ee11..27e60eb 100644
--- a/manager.cpp
+++ b/manager.cpp
@@ -343,8 +343,8 @@
return;
}
- static const std::string remove =
- std::string(PIM_PERSIST_PATH) + INVENTORY_ROOT;
+ static const std::string remove = std::string(PIM_PERSIST_PATH) +
+ INVENTORY_ROOT;
std::map<sdbusplus::message::object_path, Object> objects;
for (const auto& dirent :
@@ -405,8 +405,8 @@
auto& getProperty =
std::get<GetPropertyValueType>(maker->second);
- condition.actualValue =
- getProperty(condition.property, ifaceIt->second);
+ condition.actualValue = getProperty(condition.property,
+ ifaceIt->second);
}
}
}
@@ -416,11 +416,11 @@
// associations file is valid so create its associations.
if (_associations.conditionMatch())
{
- std::for_each(
- _refs.begin(), _refs.end(), [this](const auto& ref) {
- _associations.createAssociations(
- ref.first, _status != ManagerStatus::RUNNING);
- });
+ std::for_each(_refs.begin(), _refs.end(),
+ [this](const auto& ref) {
+ _associations.createAssociations(
+ ref.first, _status != ManagerStatus::RUNNING);
+ });
}
}
#endif
diff --git a/test/associations_test.cpp b/test/associations_test.cpp
index 6515ee3..8254838 100644
--- a/test/associations_test.cpp
+++ b/test/associations_test.cpp
@@ -141,8 +141,7 @@
class AssocsTest : public ::testing::Test
{
protected:
- AssocsTest() : ::testing::Test(), bus(sdbusplus::bus::new_default())
- {}
+ AssocsTest() : ::testing::Test(), bus(sdbusplus::bus::new_default()) {}
fs::path jsonDir;
sdbusplus::bus_t bus;
diff --git a/test/interface_ops_test.cpp b/test/interface_ops_test.cpp
index b6d6ac8..1fb15ed 100644
--- a/test/interface_ops_test.cpp
+++ b/test/interface_ops_test.cpp
@@ -121,8 +121,8 @@
EXPECT_CALL(mock, constructWithProperties(_, _, _)).Times(0);
auto b = sdbusplus::get_mocked_new(&interface);
- auto r =
- MakeInterface<DummyInterfaceWithoutProperties>::op(b, "foo", i, false);
+ auto r = MakeInterface<DummyInterfaceWithoutProperties>::op(b, "foo", i,
+ false);
EXPECT_NO_THROW(
std::any_cast<std::shared_ptr<DummyInterfaceWithoutProperties>>(r));
@@ -138,8 +138,8 @@
EXPECT_CALL(mock, constructWithProperties(_, _, _)).Times(0);
auto b = sdbusplus::get_mocked_new(&interface);
- auto r =
- MakeInterface<DummyInterfaceWithoutProperties>::op(b, "foo", i, false);
+ auto r = MakeInterface<DummyInterfaceWithoutProperties>::op(b, "foo", i,
+ false);
EXPECT_NO_THROW(
std::any_cast<std::shared_ptr<DummyInterfaceWithoutProperties>>(r));
@@ -155,8 +155,8 @@
EXPECT_CALL(mock, constructWithProperties("bar", _, _)).Times(1);
auto b = sdbusplus::get_mocked_new(&interface);
- auto r =
- MakeInterface<DummyInterfaceWithProperties>::op(b, "bar", i, false);
+ auto r = MakeInterface<DummyInterfaceWithProperties>::op(b, "bar", i,
+ false);
EXPECT_NO_THROW(
std::any_cast<std::shared_ptr<DummyInterfaceWithProperties>>(r));
@@ -172,8 +172,8 @@
EXPECT_CALL(mock, constructWithProperties("foo", _, _)).Times(1);
auto b = sdbusplus::get_mocked_new(&interface);
- auto r =
- MakeInterface<DummyInterfaceWithProperties>::op(b, "foo", i, false);
+ auto r = MakeInterface<DummyInterfaceWithProperties>::op(b, "foo", i,
+ false);
EXPECT_NO_THROW(
std::any_cast<std::shared_ptr<DummyInterfaceWithProperties>>(r));
@@ -188,8 +188,8 @@
EXPECT_CALL(mock, setPropertyByName(_, _, _)).Times(0);
auto b = sdbusplus::get_mocked_new(&interface);
- auto r =
- MakeInterface<DummyInterfaceWithoutProperties>::op(b, "foo", i, false);
+ auto r = MakeInterface<DummyInterfaceWithoutProperties>::op(b, "foo", i,
+ false);
AssignInterface<DummyInterfaceWithoutProperties>::op(i, r, false);
}
@@ -203,8 +203,8 @@
EXPECT_CALL(mock, setPropertyByName(_, _, _)).Times(0);
auto b = sdbusplus::get_mocked_new(&interface);
- auto r =
- MakeInterface<DummyInterfaceWithoutProperties>::op(b, "foo", i, false);
+ auto r = MakeInterface<DummyInterfaceWithoutProperties>::op(b, "foo", i,
+ false);
AssignInterface<DummyInterfaceWithoutProperties>::op(i, r, false);
}
@@ -218,8 +218,8 @@
EXPECT_CALL(mock, setPropertyByName(_, _, _)).Times(0);
auto b = sdbusplus::get_mocked_new(&interface);
- auto r =
- MakeInterface<DummyInterfaceWithProperties>::op(b, "foo", i, false);
+ auto r = MakeInterface<DummyInterfaceWithProperties>::op(b, "foo", i,
+ false);
AssignInterface<DummyInterfaceWithProperties>::op(i, r, false);
}
@@ -233,8 +233,8 @@
EXPECT_CALL(mock, setPropertyByName("foo"s, 1ll, _)).Times(1);
auto b = sdbusplus::get_mocked_new(&interface);
- auto r =
- MakeInterface<DummyInterfaceWithProperties>::op(b, "bar", i, false);
+ auto r = MakeInterface<DummyInterfaceWithProperties>::op(b, "bar", i,
+ false);
AssignInterface<DummyInterfaceWithProperties>::op(i, r, false);
}
@@ -246,8 +246,8 @@
sdbusplus::SdBusMock interface;
auto b = sdbusplus::get_mocked_new(&interface);
- auto r =
- MakeInterface<DummyInterfaceWithoutProperties>::op(b, "foo", i, false);
+ auto r = MakeInterface<DummyInterfaceWithoutProperties>::op(b, "foo", i,
+ false);
EXPECT_CALL(mock, serializeTwoArgs("/foo"s, "bar"s)).Times(1);
@@ -262,8 +262,8 @@
sdbusplus::SdBusMock interface;
auto b = sdbusplus::get_mocked_new(&interface);
- auto r =
- MakeInterface<DummyInterfaceWithoutProperties>::op(b, "foo", i, false);
+ auto r = MakeInterface<DummyInterfaceWithoutProperties>::op(b, "foo", i,
+ false);
EXPECT_CALL(mock, serializeTwoArgs("/foo"s, "bar"s)).Times(1);
@@ -278,8 +278,8 @@
sdbusplus::SdBusMock interface;
auto b = sdbusplus::get_mocked_new(&interface);
- auto r =
- MakeInterface<DummyInterfaceWithProperties>::op(b, "foo", i, false);
+ auto r = MakeInterface<DummyInterfaceWithProperties>::op(b, "foo", i,
+ false);
EXPECT_CALL(mock, serializeThreeArgs("/foo"s, "bar"s, _)).Times(1);
@@ -294,8 +294,8 @@
sdbusplus::SdBusMock interface;
auto b = sdbusplus::get_mocked_new(&interface);
- auto r =
- MakeInterface<DummyInterfaceWithProperties>::op(b, "foo", i, false);
+ auto r = MakeInterface<DummyInterfaceWithProperties>::op(b, "foo", i,
+ false);
EXPECT_CALL(mock, serializeThreeArgs("/foo"s, "bar"s, _)).Times(1);
@@ -310,8 +310,8 @@
sdbusplus::SdBusMock interface;
auto b = sdbusplus::get_mocked_new(&interface);
- auto r =
- MakeInterface<DummyInterfaceWithoutProperties>::op(b, "foo", i, false);
+ auto r = MakeInterface<DummyInterfaceWithoutProperties>::op(b, "foo", i,
+ false);
EXPECT_CALL(mock, deserializeNoop()).Times(1);
@@ -326,8 +326,8 @@
sdbusplus::SdBusMock interface;
auto b = sdbusplus::get_mocked_new(&interface);
- auto r =
- MakeInterface<DummyInterfaceWithoutProperties>::op(b, "foo", i, false);
+ auto r = MakeInterface<DummyInterfaceWithoutProperties>::op(b, "foo", i,
+ false);
EXPECT_CALL(mock, deserializeNoop()).Times(1);
@@ -342,8 +342,8 @@
sdbusplus::SdBusMock interface;
auto b = sdbusplus::get_mocked_new(&interface);
- auto r =
- MakeInterface<DummyInterfaceWithProperties>::op(b, "foo", i, false);
+ auto r = MakeInterface<DummyInterfaceWithProperties>::op(b, "foo", i,
+ false);
EXPECT_CALL(mock, deserializeThreeArgs("/foo"s, "bar"s, _)).Times(1);
@@ -358,8 +358,8 @@
sdbusplus::SdBusMock interface;
auto b = sdbusplus::get_mocked_new(&interface);
- auto r =
- MakeInterface<DummyInterfaceWithProperties>::op(b, "foo", i, false);
+ auto r = MakeInterface<DummyInterfaceWithProperties>::op(b, "foo", i,
+ false);
EXPECT_CALL(mock, deserializeThreeArgs("/foo"s, "bar"s, _)).Times(1);
diff --git a/test/types_test.cpp b/test/types_test.cpp
index dabcd9a..b365dc3 100644
--- a/test/types_test.cpp
+++ b/test/types_test.cpp
@@ -8,21 +8,12 @@
struct Empty
{};
-void functionUsingInterfaceVariantType(InterfaceVariantType&)
-{}
-void functionUsingInterfaceType(InterfaceType<Empty>&)
-{}
-void functionUsingObjectType(ObjectType<Empty>&)
-{}
-void functionUsingInterface(Interface&)
-{}
-void functionUsingObject(Object&)
-{}
-void functionUsingAction(Action&)
-{}
-void functionUsingFilter(Filter&)
-{}
-void functionUsingPathCondition(PathCondition&)
-{}
-void functionUsingGetProperty(GetProperty<Empty>&)
-{}
+void functionUsingInterfaceVariantType(InterfaceVariantType&) {}
+void functionUsingInterfaceType(InterfaceType<Empty>&) {}
+void functionUsingObjectType(ObjectType<Empty>&) {}
+void functionUsingInterface(Interface&) {}
+void functionUsingObject(Object&) {}
+void functionUsingAction(Action&) {}
+void functionUsingFilter(Filter&) {}
+void functionUsingPathCondition(PathCondition&) {}
+void functionUsingGetProperty(GetProperty<Empty>&) {}
diff --git a/utils.hpp b/utils.hpp
index fbe1d6a..d709b6f 100644
--- a/utils.hpp
+++ b/utils.hpp
@@ -133,8 +133,7 @@
*
* @param[in] c - The function object being adapted.
*/
- explicit CompareFirst(Compare&& c) : compare(std::forward<Compare>(c))
- {}
+ explicit CompareFirst(Compare&& c) : compare(std::forward<Compare>(c)) {}
/** @brief Compare two pairs adapter.
*
@@ -209,8 +208,7 @@
*
* @param[in] p - The prefix to check for and remove.
*/
- explicit RelPathCompare(const char* p) : prefix(p)
- {}
+ explicit RelPathCompare(const char* p) : prefix(p) {}
/** @brief Check for the prefix and remove if found.
*