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: Idb72665dbadfa8afd569a2e0e254d84f0a2108d3
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/.clang-format b/.clang-format
index 8c5278e..d92a3f1 100644
--- a/.clang-format
+++ b/.clang-format
@@ -5,22 +5,24 @@
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
-AlignEscapedNewlinesLeft: false
-AlignOperands: true
-AlignTrailingComments: true
+AlignEscapedNewlines: Right
+AlignOperands: Align
+AlignTrailingComments:
+ Kind: Always
+ OverEmptyLines: 1
AllowAllParametersOfDeclarationOnNextLine: true
-AllowShortBlocksOnASingleLine: false
+AllowShortBlocksOnASingleLine: Empty
AllowShortCaseLabelsOnASingleLine: false
-AllowShortFunctionsOnASingleLine: None
+AllowShortFunctionsOnASingleLine: Empty
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,20 +31,30 @@
AfterObjCDeclaration: true
AfterStruct: true
AfterUnion: true
+ AfterExternBlock: true
BeforeCatch: true
BeforeElse: true
IndentBraces: false
+ SplitEmptyFunction: false
+ SplitEmptyRecord: false
+ SplitEmptyNamespace: false
+BreakAfterAttributes: Never
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: AfterColon
+BreakInheritanceList: AfterColon
+BreakStringLiterals: false
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
@@ -50,21 +62,29 @@
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
+IndentRequiresClause: true
IndentWidth: 4
IndentWrappedFunctionNames: true
-KeepEmptyLinesAtTheStartOfBlocks: true
+InsertNewlineAtEOF: true
+KeepEmptyLinesAtTheStartOfBlocks: false
+LambdaBodyIndentation: OuterScope
+LineEnding: LF
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
@@ -72,19 +92,29 @@
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
+PenaltyBreakAssignment: 25
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
-PointerAlignment: Left
+PenaltyIndentedWhitespace: 0
+QualifierAlignment: Left
+ReferenceAlignment: Left
ReflowComments: true
+RequiresClausePosition: OwnLine
+RequiresExpressionIndentation: Keyword
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 +122,8 @@
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
-Standard: Cpp11
+Standard: Latest
TabWidth: 4
UseTab: Never
...
+
diff --git a/src/activation.cpp b/src/activation.cpp
index 9112c3f..1ecfd47 100644
--- a/src/activation.cpp
+++ b/src/activation.cpp
@@ -4,11 +4,12 @@
#include "utils.hpp"
-#include <cassert>
-#include <filesystem>
#include <phosphor-logging/elog-errors.hpp>
#include <phosphor-logging/log.hpp>
+#include <cassert>
+#include <filesystem>
+
namespace phosphor
{
namespace software
@@ -274,8 +275,8 @@
bool Activation::isCompatible(const std::string& psuInventoryPath)
{
- auto service =
- utils::getService(bus, psuInventoryPath.c_str(), ASSET_IFACE);
+ auto service = utils::getService(bus, psuInventoryPath.c_str(),
+ ASSET_IFACE);
auto psuManufacturer = utils::getProperty<std::string>(
bus, service.c_str(), psuInventoryPath.c_str(), ASSET_IFACE,
MANUFACTURER);
diff --git a/src/activation.hpp b/src/activation.hpp
index 6af99cd..fc32827 100644
--- a/src/activation.hpp
+++ b/src/activation.hpp
@@ -7,7 +7,6 @@
#include "types.hpp"
#include "version.hpp"
-#include <queue>
#include <sdbusplus/server.hpp>
#include <xyz/openbmc_project/Association/Definitions/server.hpp>
#include <xyz/openbmc_project/Common/FilePath/server.hpp>
@@ -16,6 +15,8 @@
#include <xyz/openbmc_project/Software/ActivationProgress/server.hpp>
#include <xyz/openbmc_project/Software/ExtendedVersion/server.hpp>
+#include <queue>
+
class TestActivation;
namespace phosphor
diff --git a/src/item_updater.cpp b/src/item_updater.cpp
index 1b38e13..6f774cb 100644
--- a/src/item_updater.cpp
+++ b/src/item_updater.cpp
@@ -4,12 +4,13 @@
#include "utils.hpp"
-#include <cassert>
-#include <filesystem>
#include <phosphor-logging/elog-errors.hpp>
#include <phosphor-logging/log.hpp>
#include <xyz/openbmc_project/Common/error.hpp>
+#include <cassert>
+#include <filesystem>
+
namespace
{
constexpr auto MANIFEST_VERSION = "version";
@@ -109,8 +110,8 @@
activationState, associations, filePath);
activations.emplace(versionId, std::move(activation));
- auto versionPtr =
- createVersionObject(path, versionId, version, purpose);
+ auto versionPtr = createVersionObject(path, versionId, version,
+ purpose);
versions.emplace(versionId, std::move(versionPtr));
}
return;
@@ -462,8 +463,8 @@
objPath, versionId, extVersion, activationState, {}, path);
activations.emplace(versionId, std::move(activation));
- auto versionPtr =
- createVersionObject(objPath, versionId, version, purpose);
+ auto versionPtr = createVersionObject(objPath, versionId,
+ version, purpose);
versions.emplace(versionId, std::move(versionPtr));
}
else
diff --git a/src/item_updater.hpp b/src/item_updater.hpp
index 0f998c8..b0e04eb 100644
--- a/src/item_updater.hpp
+++ b/src/item_updater.hpp
@@ -8,12 +8,13 @@
#include "utils.hpp"
#include "version.hpp"
-#include <filesystem>
#include <phosphor-logging/log.hpp>
#include <sdbusplus/server.hpp>
#include <xyz/openbmc_project/Association/Definitions/server.hpp>
#include <xyz/openbmc_project/Collection/DeleteAll/server.hpp>
+#include <filesystem>
+
class TestItemUpdater;
namespace phosphor
@@ -35,9 +36,10 @@
/** @class ItemUpdater
* @brief Manages the activation of the PSU version items.
*/
-class ItemUpdater : public ItemUpdaterInherit,
- public AssociationInterface,
- public ActivationListener
+class ItemUpdater :
+ public ItemUpdaterInherit,
+ public AssociationInterface,
+ public ActivationListener
{
friend class ::TestItemUpdater;
diff --git a/src/main.cpp b/src/main.cpp
index b15923a..ecadaa0 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -5,6 +5,7 @@
#include <phosphor-logging/log.hpp>
#include <sdbusplus/bus.hpp>
#include <sdbusplus/server/manager.hpp>
+
#include <system_error>
int main(int /* argc */, char* /* argv */[])
diff --git a/src/utils.cpp b/src/utils.cpp
index 0626543..09ed5d3 100644
--- a/src/utils.cpp
+++ b/src/utils.cpp
@@ -4,9 +4,10 @@
#include <openssl/evp.h>
+#include <phosphor-logging/log.hpp>
+
#include <algorithm>
#include <fstream>
-#include <phosphor-logging/log.hpp>
#include <sstream>
using namespace phosphor::logging;
@@ -24,7 +25,7 @@
namespace internal
{
template <typename... Ts>
-std::string concat_string(Ts const&... ts)
+std::string concat_string(const Ts&... ts)
{
std::stringstream s;
((s << ts << " "), ...) << std::endl;
@@ -34,7 +35,7 @@
// Helper function to run command
// Returns return code and the stdout
template <typename... Ts>
-std::pair<int, std::string> exec(Ts const&... ts)
+std::pair<int, std::string> exec(const Ts&... ts)
{
std::array<char, 512> buffer;
std::string cmd = concat_string(ts...);
@@ -176,8 +177,8 @@
{
return std::find_if(assocs.begin(), assocs.end(),
[&psuInventoryPath](const auto& assoc) {
- return psuInventoryPath == std::get<2>(assoc);
- }) != assocs.end();
+ return psuInventoryPath == std::get<2>(assoc);
+ }) != assocs.end();
}
any Utils::getPropertyImpl(sdbusplus::bus_t& bus, const char* service,
diff --git a/src/utils.hpp b/src/utils.hpp
index 13c7b62..446f024 100644
--- a/src/utils.hpp
+++ b/src/utils.hpp
@@ -2,8 +2,9 @@
#include "types.hpp"
-#include <any>
#include <sdbusplus/bus.hpp>
+
+#include <any>
#include <set>
#include <string>
#include <vector>
@@ -140,8 +141,8 @@
T getProperty(sdbusplus::bus_t& bus, const char* service, const char* path,
const char* interface, const char* propertyName) const
{
- any result =
- getPropertyImpl(bus, service, path, interface, propertyName);
+ any result = getPropertyImpl(bus, service, path, interface,
+ propertyName);
auto value = any_cast<PropertyType>(result);
return std::get<T>(value);
}
diff --git a/src/version.cpp b/src/version.cpp
index b6ca139..58abf79 100644
--- a/src/version.cpp
+++ b/src/version.cpp
@@ -2,14 +2,15 @@
#include "item_updater.hpp"
-#include <fstream>
-#include <iostream>
#include <phosphor-logging/elog-errors.hpp>
#include <phosphor-logging/log.hpp>
+#include <xyz/openbmc_project/Common/error.hpp>
+
+#include <fstream>
+#include <iostream>
#include <sstream>
#include <stdexcept>
#include <string>
-#include <xyz/openbmc_project/Common/error.hpp>
namespace phosphor
{
diff --git a/src/version.hpp b/src/version.hpp
index 37c7e38..021aadd 100644
--- a/src/version.hpp
+++ b/src/version.hpp
@@ -41,8 +41,7 @@
Delete(sdbusplus::bus_t& bus, const std::string& path, Version& version) :
DeleteInherit(bus, path.c_str(), action::emit_interface_added),
version(version)
- {
- }
+ {}
/**
* @brief Delete the D-Bus object.