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: I6083e412d8356a97b5213a138f370bfeb43a69b3
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/.clang-format b/.clang-format
index ae9ad39..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,19 +31,28 @@
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
@@ -51,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
@@ -73,18 +92,29 @@
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
+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/callout.cpp b/callout.cpp
index cf88519..f7ae06f 100644
--- a/callout.cpp
+++ b/callout.cpp
@@ -22,9 +22,10 @@
#include <cereal/types/string.hpp>
#include <cereal/types/tuple.hpp>
#include <cereal/types/vector.hpp>
+#include <phosphor-logging/log.hpp>
+
#include <experimental/filesystem>
#include <fstream>
-#include <phosphor-logging/log.hpp>
CEREAL_CLASS_VERSION(ibm::logging::Callout, CALLOUT_CLASS_VERSION);
@@ -85,8 +86,7 @@
size_t id, uint64_t timestamp) :
CalloutObject(bus, objectPath.c_str(), CalloutObject::action::defer_emit),
entryID(id), timestamp(timestamp)
-{
-}
+{}
Callout::Callout(sdbusplus::bus_t& bus, const std::string& objectPath,
const std::string& inventoryPath, size_t id,
diff --git a/dbus.cpp b/dbus.cpp
index 49e0e03..d5fdd69 100644
--- a/dbus.cpp
+++ b/dbus.cpp
@@ -90,11 +90,10 @@
{
auto s = std::find_if(services->second.begin(), services->second.end(),
[&interface](const auto& entry) {
- auto i =
- std::find(entry.second.begin(),
- entry.second.end(), interface);
- return i != entry.second.end();
- });
+ auto i = std::find(entry.second.begin(), entry.second.end(),
+ interface);
+ return i != entry.second.end();
+ });
if (s != services->second.end())
{
service = s->first;
diff --git a/dbus.hpp b/dbus.hpp
index 3091fbf..08cf4f4 100644
--- a/dbus.hpp
+++ b/dbus.hpp
@@ -1,7 +1,8 @@
#pragma once
-#include <map>
#include <sdbusplus/server.hpp>
+
+#include <map>
#include <string>
#include <vector>
diff --git a/manager.cpp b/manager.cpp
index fd421f0..8b1bf1b 100644
--- a/manager.cpp
+++ b/manager.cpp
@@ -226,8 +226,8 @@
continue;
}
- auto properties =
- getAllProperties(bus, service, callout, ASSET_IFACE);
+ auto properties = getAllProperties(bus, service, callout,
+ ASSET_IFACE);
if (properties.empty())
{
continue;
diff --git a/manager.hpp b/manager.hpp
index b9a2039..8576ec4 100644
--- a/manager.hpp
+++ b/manager.hpp
@@ -5,10 +5,11 @@
#include "dbus.hpp"
#include "interfaces.hpp"
+#include <sdbusplus/bus.hpp>
+
#include <any>
#include <experimental/filesystem>
#include <map>
-#include <sdbusplus/bus.hpp>
#include <string>
#ifdef USE_POLICY_INTERFACE
#include "policy_table.hpp"
diff --git a/policy_find.cpp b/policy_find.cpp
index bf58301..2e39dc9 100644
--- a/policy_find.cpp
+++ b/policy_find.cpp
@@ -16,6 +16,7 @@
#include "policy_find.hpp"
#include <phosphor-logging/log.hpp>
+
#include <sstream>
namespace ibm
@@ -168,8 +169,8 @@
std::string getSearchModifierFirstTry(const std::string& message,
const DbusPropertyMap& properties)
{
- auto data =
- getProperty<std::vector<std::string>>(properties, "AdditionalData");
+ auto data = getProperty<std::vector<std::string>>(properties,
+ "AdditionalData");
if (!data)
{
@@ -226,8 +227,8 @@
// AdditionalData property. Try them all until one
// is found.
- auto data =
- getProperty<std::vector<std::string>>(properties, "AdditionalData");
+ auto data = getProperty<std::vector<std::string>>(properties,
+ "AdditionalData");
if (!data)
{
@@ -306,8 +307,8 @@
// Try with the FirstTry modifier first, and then the regular one.
- auto modifier =
- getSearchModifierFirstTry(*errorMsg, errorLogProperties);
+ auto modifier = getSearchModifierFirstTry(*errorMsg,
+ errorLogProperties);
if (!modifier.empty())
{
diff --git a/policy_table.cpp b/policy_table.cpp
index f77bc6e..7877e45 100644
--- a/policy_table.cpp
+++ b/policy_table.cpp
@@ -15,11 +15,12 @@
*/
#include "policy_table.hpp"
-#include <experimental/filesystem>
-#include <fstream>
#include <nlohmann/json.hpp>
#include <phosphor-logging/log.hpp>
+#include <experimental/filesystem>
+#include <fstream>
+
namespace ibm
{
namespace logging