Update clang format file
Updated clang format file from docs repo to match with clang-format 10.
Also fixed some of files as per new clang format.
Change-Id: I36277447722e5c52dac49e0da745b0b0e870d298
Signed-off-by: Vijay Khemka <vijaykhemka@fb.com>
diff --git a/.clang-format b/.clang-format
index bbc1bb1..38b2669 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: false
+AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
+ AfterCaseLabel: true
AfterClass: true
AfterControlStatement: true
AfterEnum: true
@@ -29,25 +29,50 @@
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
Cpp11BracedListStyle: true
-DerivePointerAlignment: true
+DerivePointerAlignment: false
PointerAlignment: Left
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
+IncludeBlocks: Regroup
+IncludeCategories:
+ - Regex: '^[<"](gtest|gmock)'
+ Priority: 7
+ - Regex: '^"config.h"'
+ Priority: -1
+ - Regex: '^".*\.h"'
+ Priority: 1
+ - Regex: '^".*\.hpp"'
+ Priority: 2
+ - Regex: '^<.*\.h>'
+ Priority: 3
+ - Regex: '^<.*\.hpp>'
+ Priority: 4
+ - Regex: '^<.*'
+ Priority: 5
+ - Regex: '.*'
+ Priority: 6
IndentCaseLabels: true
IndentWidth: 4
IndentWrappedFunctionNames: true
@@ -65,12 +90,17 @@
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
-PointerAlignment: Right
ReflowComments: true
SortIncludes: false
+SortUsingDeclarations: true
SpaceAfterCStyleCast: false
+SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
+SpaceBeforeCpp11BracedList: false
+SpaceBeforeCtorInitializerColon: true
+SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
+SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
diff --git a/src/oemcommands.cpp b/src/oemcommands.cpp
index 60afb13..be03ca3 100644
--- a/src/oemcommands.cpp
+++ b/src/oemcommands.cpp
@@ -182,7 +182,8 @@
switch (static_cast<LanParam>(lan_param))
{
- case LanParam::IP: {
+ case LanParam::IP:
+ {
auto ethIP = ethdevice + "/" + ipmi::network::IPV4_TYPE;
std::string ipaddress;
auto ipObjectInfo = ipmi::network::getIPObject(
@@ -198,7 +199,8 @@
}
break;
- case LanParam::IPV6: {
+ case LanParam::IPV6:
+ {
auto ethIP = ethdevice + "/" + ipmi::network::IPV6_TYPE;
std::string ipaddress;
auto ipObjectInfo = ipmi::network::getIPObject(
@@ -214,7 +216,8 @@
}
break;
- case LanParam::MAC: {
+ case LanParam::MAC:
+ {
std::string macAddress;
auto macObjectInfo =
ipmi::getDbusObject(bus, ipmi::network::MAC_INTERFACE,
diff --git a/src/selcommands.cpp b/src/selcommands.cpp
index e305c44..127a593 100644
--- a/src/selcommands.cpp
+++ b/src/selcommands.cpp
@@ -362,13 +362,15 @@
case 0xA:
errLog = "Bus Fatal" + tmp1.str();
break;
- case 0xD: {
+ case 0xD:
+ {
uint32_t venId = (uint32_t)data[1] << 8 | (uint32_t)data[2];
tmp2 << "Vendor ID: 0x" << std::setw(4) << venId;
errLog = tmp2.str();
}
break;
- case 0xE: {
+ case 0xE:
+ {
uint32_t devId = (uint32_t)data[1] << 8 | (uint32_t)data[2];
tmp2 << "Device ID: 0x" << std::setw(4) << devId;
errLog = tmp2.str();
@@ -479,7 +481,8 @@
switch ((data[1] & 0xC) >> 2)
{
- case 0x0: {
+ case 0x0:
+ {
/* All Info Valid */
uint8_t chnNum = (data[2] & 0x1C) >> 2;
diff --git a/src/usb-dbg.cpp b/src/usb-dbg.cpp
index 7d5f74e..2588f81 100644
--- a/src/usb-dbg.cpp
+++ b/src/usb-dbg.cpp
@@ -105,8 +105,7 @@
uint8_t overwrite;
time_t mtime;
frame() : buf(NULL), pages(0), mtime(0)
- {
- }
+ {}
int init(size_t size);
int append(const char* string, int indent);
int insert(const char* string, int indent);