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: I1d7d35c8035993df4c164bfb055d3be476d3ea84
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/example/asio-example.cpp b/example/asio-example.cpp
index 8138dea..474d261 100644
--- a/example/asio-example.cpp
+++ b/example/asio-example.cpp
@@ -230,7 +230,7 @@
[](const std::string& req, std::string& propertyValue) {
propertyValue = req;
return true;
- },
+ },
// custom get
[](const std::string& property) {
auto now = std::chrono::system_clock::now();
@@ -334,7 +334,7 @@
{
std::cout << item.first << "\n";
}
- },
+ },
"xyz.openbmc_project.ObjectMapper",
"/xyz/openbmc_project/object_mapper",
"xyz.openbmc_project.ObjectMapper", "GetSubTree",
@@ -355,7 +355,7 @@
{
std::cerr << "async_method_call should have failed!\n";
}
- },
+ },
"xyz.openbmc_project.ObjectMapper",
"/xyz/openbmc_project/object_mapper",
"xyz.openbmc_project.ObjectMapper", "GetSubTree",
@@ -391,7 +391,7 @@
return;
}
std::cout << "TestYieldFunction return " << testValue << "\n";
- },
+ },
"xyz.openbmc_project.asio-test", "/xyz/openbmc_project/test",
"xyz.openbmc_project.test", "TestYieldFunction", int32_t(41));
io.run();
diff --git a/example/coroutine-example.cpp b/example/coroutine-example.cpp
index c077acd..2302f47 100644
--- a/example/coroutine-example.cpp
+++ b/example/coroutine-example.cpp
@@ -50,9 +50,9 @@
{
return std::to_string(v);
}
- },
+ },
value)
- << std::endl;
+ << std::endl;
}
// Try to set the Architecture property (which won't work).
diff --git a/example/get-all-properties.cpp b/example/get-all-properties.cpp
index 711dd8b..35e9783 100644
--- a/example/get-all-properties.cpp
+++ b/example/get-all-properties.cpp
@@ -35,7 +35,7 @@
[this](const auto& newPropertyValue, const auto&) {
goodbyes_ = newPropertyValue;
return true;
- },
+ },
[this](const auto&) { return goodbyes_; });
demo_->register_property_r<uint32_t>(
@@ -84,49 +84,48 @@
const std::vector<std::pair<
std::string, std::variant<std::monostate, std::string>>>&
properties) -> void {
- if (ec)
- {
- logSystemErrorCode(ec);
- return;
- }
- {
- const std::string* greetings = nullptr;
- const std::string* goodbyes = nullptr;
- const bool success = sdbusplus::unpackPropertiesNoThrow(
- [this](const sdbusplus::UnpackErrorReason reason,
- const std::string& property) {
+ if (ec)
+ {
+ logSystemErrorCode(ec);
+ return;
+ }
+ {
+ const std::string* greetings = nullptr;
+ const std::string* goodbyes = nullptr;
+ const bool success = sdbusplus::unpackPropertiesNoThrow(
+ [this](const sdbusplus::UnpackErrorReason reason,
+ const std::string& property) {
logUnpackError(reason, property);
- },
- properties, propertyGrettingName, greetings,
- propertyGoodbyesName, goodbyes);
+ },
+ properties, propertyGrettingName, greetings,
+ propertyGoodbyesName, goodbyes);
- if (success)
- {
- std::cout << "value of greetings: " << *greetings
- << "\n";
- std::cout << "value of goodbyes: " << *goodbyes << "\n";
- }
- else
- {
- ++fatalErrors_;
- }
- }
-
- try
+ if (success)
{
- std::string value;
- sdbusplus::unpackProperties(properties, propertyValueName,
- value);
-
- std::cerr << "Error: it should fail because of "
- "not matched type\n";
+ std::cout << "value of greetings: " << *greetings << "\n";
+ std::cout << "value of goodbyes: " << *goodbyes << "\n";
+ }
+ else
+ {
++fatalErrors_;
}
- catch (const sdbusplus::exception::UnpackPropertyError& error)
- {
- logExpectedException(error);
- }
- });
+ }
+
+ try
+ {
+ std::string value;
+ sdbusplus::unpackProperties(properties, propertyValueName,
+ value);
+
+ std::cerr << "Error: it should fail because of "
+ "not matched type\n";
+ ++fatalErrors_;
+ }
+ catch (const sdbusplus::exception::UnpackPropertyError& error)
+ {
+ logExpectedException(error);
+ }
+ });
}
void asyncGetAllProperties()
@@ -138,60 +137,59 @@
std::string,
std::variant<std::monostate, std::string, uint32_t>>>&
properties) -> void {
- if (ec)
- {
- logSystemErrorCode(ec);
- return;
- }
- try
- {
- std::string greetings;
- std::string goodbyes;
- uint32_t value = 0u;
- sdbusplus::unpackProperties(properties,
- propertyGrettingName, greetings,
- propertyGoodbyesName, goodbyes,
- propertyValueName, value);
+ if (ec)
+ {
+ logSystemErrorCode(ec);
+ return;
+ }
+ try
+ {
+ std::string greetings;
+ std::string goodbyes;
+ uint32_t value = 0u;
+ sdbusplus::unpackProperties(properties, propertyGrettingName,
+ greetings, propertyGoodbyesName,
+ goodbyes, propertyValueName, value);
- std::cout << "value of greetings: " << greetings << "\n";
- std::cout << "value of goodbyes: " << goodbyes << "\n";
- std::cout << "value of value: " << value << "\n";
- }
- catch (const sdbusplus::exception::UnpackPropertyError& error)
- {
- logException(error);
- }
+ std::cout << "value of greetings: " << greetings << "\n";
+ std::cout << "value of goodbyes: " << goodbyes << "\n";
+ std::cout << "value of value: " << value << "\n";
+ }
+ catch (const sdbusplus::exception::UnpackPropertyError& error)
+ {
+ logException(error);
+ }
- try
- {
- std::string unknownProperty;
- sdbusplus::unpackProperties(
- properties, "UnknownPropertyName", unknownProperty);
+ try
+ {
+ std::string unknownProperty;
+ sdbusplus::unpackProperties(properties, "UnknownPropertyName",
+ unknownProperty);
- std::cerr << "Error: it should fail because of "
- "missing property\n";
- ++fatalErrors_;
- }
- catch (const sdbusplus::exception::UnpackPropertyError& error)
- {
- logExpectedException(error);
- }
+ std::cerr << "Error: it should fail because of "
+ "missing property\n";
+ ++fatalErrors_;
+ }
+ catch (const sdbusplus::exception::UnpackPropertyError& error)
+ {
+ logExpectedException(error);
+ }
- try
- {
- uint32_t notMatchingType;
- sdbusplus::unpackProperties(
- properties, propertyGrettingName, notMatchingType);
+ try
+ {
+ uint32_t notMatchingType;
+ sdbusplus::unpackProperties(properties, propertyGrettingName,
+ notMatchingType);
- std::cerr << "Error: it should fail because of "
- "not matched type\n";
- ++fatalErrors_;
- }
- catch (const sdbusplus::exception::UnpackPropertyError& error)
- {
- logExpectedException(error);
- }
- });
+ std::cerr << "Error: it should fail because of "
+ "not matched type\n";
+ ++fatalErrors_;
+ }
+ catch (const sdbusplus::exception::UnpackPropertyError& error)
+ {
+ logExpectedException(error);
+ }
+ });
}
private:
diff --git a/example/register-property.cpp b/example/register-property.cpp
index c22231a..e10b0f1 100644
--- a/example/register-property.cpp
+++ b/example/register-property.cpp
@@ -34,9 +34,9 @@
[this](const auto& newPropertyValue, const auto&) {
goodbyes_ = newPropertyValue;
return true;
- },
+ },
[this](const auto&) { return goodbyes_; });
- });
+ });
}
uint32_t fatalErrors() const
@@ -69,7 +69,7 @@
std::cerr << "Error: it was expected to fail getProperty due "
"to wrong type\n";
++fatalErrors_;
- });
+ });
}
void asyncReadProperties()
@@ -84,7 +84,7 @@
return;
}
std::cout << "Greetings value is: " << value << "\n";
- });
+ });
sdbusplus::asio::getProperty<std::string>(
bus_, demoServiceName, demoObjectPath, demoInterfaceName,
@@ -96,7 +96,7 @@
return;
}
std::cout << "Goodbyes value is: " << value << "\n";
- });
+ });
}
void asyncChangeProperty()
@@ -114,7 +114,7 @@
std::cout << "Error: it was expected to fail to change greetings\n";
++fatalErrors_;
- });
+ });
sdbusplus::asio::setProperty(
bus_, demoServiceName, demoObjectPath, demoInterfaceName,
@@ -130,7 +130,7 @@
}
std::cout << "Changed goodbyes property as expected\n";
boost::asio::post(ioc_, [this] { asyncReadProperties(); });
- });
+ });
}
void syncChangeGoodbyes(std::string_view value)