style: update clang-format
Pull the most recent OpenBMC style rules and run clang-format.
Change-Id: I11a25ea1e62d6c739010d9dd742a139fb17cc09a
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/.clang-format b/.clang-format
index ea71ad6..52ac0a1 100644
--- a/.clang-format
+++ b/.clang-format
@@ -5,7 +5,7 @@
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
-AlignEscapedNewlinesLeft: false
+AlignEscapedNewlines: Right
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
@@ -14,13 +14,13 @@
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
-AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
-AlwaysBreakTemplateDeclarations: true
+AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
+ AfterCaseLabel: true
AfterClass: true
AfterControlStatement: true
AfterEnum: true
@@ -29,15 +29,22 @@
AfterObjCDeclaration: true
AfterStruct: true
AfterUnion: true
+ AfterExternBlock: true
BeforeCatch: true
BeforeElse: true
IndentBraces: false
+ SplitEmptyFunction: false
+ SplitEmptyRecord: false
+ SplitEmptyNamespace: false
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: AfterColon
+BreakInheritanceList: AfterColon
+BreakStringLiterals: true
ColumnLimit: 80
CommentPragmas: '^ IWYU pragma:'
+CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
@@ -51,17 +58,21 @@
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^[<"](gtest|gmock)'
- Priority: 5
+ Priority: 7
- Regex: '^"config.h"'
Priority: -1
- - Regex: '^".*\.hpp"'
+ - Regex: '^".*\.h"'
Priority: 1
- - Regex: '^<.*\.h>'
+ - Regex: '^".*\.hpp"'
Priority: 2
- - Regex: '^<.*'
+ - Regex: '^<.*\.h>'
Priority: 3
- - Regex: '.*'
+ - Regex: '^<.*\.hpp>'
Priority: 4
+ - Regex: '^<.*'
+ Priority: 5
+ - Regex: '.*'
+ Priority: 6
IndentCaseLabels: true
IndentWidth: 4
IndentWrappedFunctionNames: true
@@ -83,8 +94,13 @@
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
+SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
+SpaceBeforeCpp11BracedList: false
+SpaceBeforeCtorInitializerColon: true
+SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
+SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
@@ -92,7 +108,7 @@
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
-Standard: Cpp11
+Standard: Latest
TabWidth: 4
UseTab: Never
...
diff --git a/app.cpp b/app.cpp
index 1ec886c..b4d7765 100644
--- a/app.cpp
+++ b/app.cpp
@@ -17,10 +17,11 @@
#include "manager.hpp"
+#include <sdbusplus/bus.hpp>
+
#include <cstdlib>
#include <exception>
#include <iostream>
-#include <sdbusplus/bus.hpp>
int main(int argc, char* argv[])
{
diff --git a/association_manager.cpp b/association_manager.cpp
index fd36eef..946bd74 100644
--- a/association_manager.cpp
+++ b/association_manager.cpp
@@ -1,10 +1,11 @@
#include "association_manager.hpp"
-#include <filesystem>
-#include <fstream>
#include <nlohmann/json.hpp>
#include <phosphor-logging/log.hpp>
+#include <filesystem>
+#include <fstream>
+
namespace phosphor
{
namespace inventory
diff --git a/association_manager.hpp b/association_manager.hpp
index 240bbdc..e38fff1 100644
--- a/association_manager.hpp
+++ b/association_manager.hpp
@@ -69,8 +69,7 @@
*/
explicit Manager(sdbusplus::bus::bus& bus) :
Manager(bus, ASSOCIATIONS_FILE_PATH)
- {
- }
+ {}
/**
* @brief Creates any association D-Bus interfaces required based on
diff --git a/errors.hpp b/errors.hpp
index cc3e306..e19f193 100644
--- a/errors.hpp
+++ b/errors.hpp
@@ -32,8 +32,7 @@
*/
InterfaceError(const char* msg, const std::string& iface) :
std::invalid_argument(msg), interface(iface)
- {
- }
+ {}
/** @brief Log the exception message to the systemd journal. */
void log() const;
diff --git a/events.hpp b/events.hpp
index 735834a..1abf444 100644
--- a/events.hpp
+++ b/events.hpp
@@ -41,8 +41,7 @@
*/
explicit Event(const std::vector<Filter>& filters, Type t = Type::STARTUP) :
std::vector<Filter>(filters), type(t)
- {
- }
+ {}
/** @brief event class enumeration. */
Type type;
@@ -74,8 +73,7 @@
*/
DbusSignal(const char* sig, const std::vector<Filter>& filters) :
Event(filters, Type::DBUS_SIGNAL), signature(sig)
- {
- }
+ {}
const char* signature;
};
diff --git a/functor.hpp b/functor.hpp
index 67dc4de..e220550 100644
--- a/functor.hpp
+++ b/functor.hpp
@@ -3,8 +3,9 @@
#include "types.hpp"
#include "utils.hpp"
-#include <memory>
#include <sdbusplus/bus.hpp>
+
+#include <memory>
#include <utility>
namespace phosphor
@@ -200,8 +201,7 @@
U&& condition) :
_iface(iface),
_property(property), _condition(std::forward<U>(condition))
- {
- }
+ {}
/** @brief Test a property value.
*
@@ -269,8 +269,7 @@
const char* property, const char* service) :
_path(path ? path : std::string()),
_iface(iface), _property(property), _service(service)
- {
- }
+ {}
/** @brief Forward comparison to type specific implementation. */
virtual bool eval(sdbusplus::message::message&) const = 0;
@@ -342,8 +341,7 @@
PropertyConditionBase(path, iface, property, service),
_condition(std::forward<decltype(condition)>(condition)),
_getProperty(getProperty)
- {
- }
+ {}
/** @brief Test a property value.
*
diff --git a/interface_ops.hpp b/interface_ops.hpp
index db429b8..96a2422 100644
--- a/interface_ops.hpp
+++ b/interface_ops.hpp
@@ -78,8 +78,7 @@
struct AssignInterface
{
static void op(const Interface&, std::any&)
- {
- }
+ {}
};
template <typename T>
@@ -139,8 +138,7 @@
};
struct DummyInterface
-{
-};
+{};
using MakeInterfaceType =
std::add_pointer_t<decltype(MakeInterface<DummyInterface>::op)>;
using AssignInterfaceType =
diff --git a/manager.cpp b/manager.cpp
index f62afc0..c7ceaa8 100644
--- a/manager.cpp
+++ b/manager.cpp
@@ -17,12 +17,13 @@
#include "errors.hpp"
+#include <phosphor-logging/log.hpp>
+
#include <algorithm>
#include <chrono>
#include <exception>
#include <filesystem>
#include <iostream>
-#include <phosphor-logging/log.hpp>
using namespace std::literals::chrono_literals;
diff --git a/manager.hpp b/manager.hpp
index 5ad4f44..ec29c79 100644
--- a/manager.hpp
+++ b/manager.hpp
@@ -9,13 +9,14 @@
#include "association_manager.hpp"
#endif
+#include <sdbusplus/server.hpp>
+#include <xyz/openbmc_project/Inventory/Manager/server.hpp>
+
#include <any>
#include <map>
#include <memory>
-#include <sdbusplus/server.hpp>
#include <string>
#include <vector>
-#include <xyz/openbmc_project/Inventory/Manager/server.hpp>
namespace sdbusplus
{
diff --git a/serialize.hpp b/serialize.hpp
index 525bc21..32648e2 100644
--- a/serialize.hpp
+++ b/serialize.hpp
@@ -3,9 +3,10 @@
#include "config.h"
#include <cereal/archives/json.hpp>
+#include <phosphor-logging/log.hpp>
+
#include <filesystem>
#include <fstream>
-#include <phosphor-logging/log.hpp>
namespace phosphor
{
diff --git a/test/associations_test.cpp b/test/associations_test.cpp
index 357659d..7da4a20 100644
--- a/test/associations_test.cpp
+++ b/test/associations_test.cpp
@@ -142,8 +142,7 @@
{
protected:
AssocsTest() : ::testing::Test(), bus(sdbusplus::bus::new_default())
- {
- }
+ {}
fs::path jsonDir;
sdbusplus::bus::bus bus;
@@ -179,8 +178,7 @@
EXPECT_TRUE(false);
}
catch (std::exception& e)
- {
- }
+ {}
}
TEST_F(AssocsTest, TEST_GOOD_JSON)
@@ -252,8 +250,7 @@
EXPECT_TRUE(false);
}
catch (std::exception& e)
- {
- }
+ {}
}
TEST_F(AssocsTest, TEST_BAD_JSON1)
@@ -267,8 +264,7 @@
EXPECT_TRUE(false);
}
catch (std::exception& e)
- {
- }
+ {}
}
TEST_F(AssocsTest, TEST_BAD_JSON2)
@@ -282,8 +278,7 @@
EXPECT_TRUE(false);
}
catch (std::exception& e)
- {
- }
+ {}
}
TEST_F(AssocsTest, TEST_BAD_JSON3)
@@ -297,6 +292,5 @@
EXPECT_TRUE(false);
}
catch (std::exception& e)
- {
- }
+ {}
}
diff --git a/test/test.cpp b/test/test.cpp
index cea8b89..e7058be 100644
--- a/test/test.cpp
+++ b/test/test.cpp
@@ -113,8 +113,7 @@
explicit SignalQueue(const std::string& match) :
_bus(sdbusplus::bus::new_default()),
_match(_bus, match.c_str(), &callback, this), _next(nullptr)
- {
- }
+ {}
auto&& pop(unsigned timeout = 1000000)
{
diff --git a/test/types_test.cpp b/test/types_test.cpp
index 04e13d5..dabcd9a 100644
--- a/test/types_test.cpp
+++ b/test/types_test.cpp
@@ -6,33 +6,23 @@
using namespace phosphor::inventory::manager;
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>&)
-{
-}
+{}
diff --git a/types.hpp b/types.hpp
index 7cb2e9d..6f842ae 100644
--- a/types.hpp
+++ b/types.hpp
@@ -1,9 +1,10 @@
#pragma once
+#include <sdbusplus/message/types.hpp>
+
#include <cstdint>
#include <functional>
#include <map>
-#include <sdbusplus/message/types.hpp>
#include <string>
namespace sdbusplus
diff --git a/utils.hpp b/utils.hpp
index 5be8bf5..eacc70e 100644
--- a/utils.hpp
+++ b/utils.hpp
@@ -1,7 +1,8 @@
#pragma once
-#include <cstring>
#include <sdbusplus/message/types.hpp>
+
+#include <cstring>
#include <stdexcept>
#include <string>
#include <type_traits>
@@ -93,8 +94,7 @@
* @param[in] c - The function object being adapted.
*/
explicit CompareFirst(Compare&& c) : compare(std::forward<Compare>(c))
- {
- }
+ {}
/** @brief Compare two pairs adapter.
*
@@ -170,8 +170,7 @@
* @param[in] p - The prefix to check for and remove.
*/
explicit RelPathCompare(const char* p) : prefix(p)
- {
- }
+ {}
/** @brief Check for the prefix and remove if found.
*