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: I1ae768f5bd68d4eec70acab9964c43370423bf5e
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/.clang-format b/.clang-format
index 3b9352e..d92a3f1 100644
--- a/.clang-format
+++ b/.clang-format
@@ -6,12 +6,14 @@
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Right
-AlignOperands: true
-AlignTrailingComments: true
+AlignOperands: Align
+AlignTrailingComments:
+ Kind: Always
+ OverEmptyLines: 1
AllowAllParametersOfDeclarationOnNextLine: true
-AllowShortBlocksOnASingleLine: false
+AllowShortBlocksOnASingleLine: Empty
AllowShortCaseLabelsOnASingleLine: false
-AllowShortFunctionsOnASingleLine: None
+AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterReturnType: None
@@ -36,12 +38,13 @@
SplitEmptyFunction: false
SplitEmptyRecord: false
SplitEmptyNamespace: false
+BreakAfterAttributes: Never
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: AfterColon
BreakInheritanceList: AfterColon
-BreakStringLiterals: true
+BreakStringLiterals: false
ColumnLimit: 80
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
@@ -49,6 +52,7 @@
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
+DeriveLineEnding: false
DerivePointerAlignment: false
PointerAlignment: Left
DisableFormat: false
@@ -74,9 +78,13 @@
- 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
@@ -84,13 +92,19 @@
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
@@ -113,4 +127,3 @@
UseTab: Never
...
-
diff --git a/include/libbej/bej_decoder_json.hpp b/include/libbej/bej_decoder_json.hpp
index 2d59d6a..21c25d6 100644
--- a/include/libbej/bej_decoder_json.hpp
+++ b/include/libbej/bej_decoder_json.hpp
@@ -15,7 +15,6 @@
*/
class BejDecoderJson
{
-
public:
/**
* @brief Decode the encoded PLDM block.
diff --git a/src/bej_decoder_core.c b/src/bej_decoder_core.c
index e8fba00..efed4fc 100644
--- a/src/bej_decoder_core.c
+++ b/src/bej_decoder_core.c
@@ -90,8 +90,8 @@
// Number of bytes need to represent the value length.
const uint8_t valueLengthSize = *(enSegment + valueLenNnintOffset);
// Start of the Value.
- const uint32_t valueOffset =
- valueLenNnintOffset + sizeof(uint8_t) + valueLengthSize;
+ const uint32_t valueOffset = valueLenNnintOffset + sizeof(uint8_t) +
+ valueLengthSize;
offsets->formatOffset = formatOffset;
offsets->valueLenNnintOffset = valueLenNnintOffset;
@@ -190,8 +190,8 @@
return bejErrorInvalidSchemaType;
}
- int ret =
- bejDictGetProperty(*dictionary, dictPropOffset, sequenceNumber, prop);
+ int ret = bejDictGetProperty(*dictionary, dictPropOffset, sequenceNumber,
+ prop);
if (ret != 0)
{
fprintf(stderr, "Failed to get dictionary property for offset: %u\n",
@@ -595,11 +595,11 @@
// nnint - Length of exp
// bejInteger - exp (includes sign for the exponent)
uint8_t wholeByteLen = (uint8_t)bejGetNnint(params->sflv.value);
- const uint8_t* wholeBejInt =
- params->sflv.value + bejGetNnintSize(params->sflv.value);
+ const uint8_t* wholeBejInt = params->sflv.value +
+ bejGetNnintSize(params->sflv.value);
const uint8_t* fractZeroCountNnint = wholeBejInt + wholeByteLen;
- const uint8_t* fractNnint =
- fractZeroCountNnint + bejGetNnintSize(fractZeroCountNnint);
+ const uint8_t* fractNnint = fractZeroCountNnint +
+ bejGetNnintSize(fractZeroCountNnint);
const uint8_t* lenExpNnint = fractNnint + bejGetNnintSize(fractNnint);
const uint8_t* expBejInt = lenExpNnint + bejGetNnintSize(lenExpNnint);
@@ -684,8 +684,8 @@
// We might have to change this for nested annotations.
params->state.mainDictPropOffset = outerProp->childPointerOffset;
// Point to the start of the value for next decoding.
- params->state.encodedStreamOffset =
- params->sflv.valueEndOffset - params->sflv.valueLength;
+ params->state.encodedStreamOffset = params->sflv.valueEndOffset -
+ params->sflv.valueLength;
return 0;
}
@@ -738,8 +738,8 @@
while (params.state.encodedStreamOffset < streamLen)
{
// Go to the next encoded segment in the encoded stream.
- params.state.encodedSubStream =
- enStream + params.state.encodedStreamOffset;
+ params.state.encodedSubStream = enStream +
+ params.state.encodedStreamOffset;
bejInitSFLVStruct(¶ms);
if (params.sflv.format.readOnlyProperty)
diff --git a/test/bej_decoder_test.cpp b/test/bej_decoder_test.cpp
index 8e9da65..185b69c 100644
--- a/test/bej_decoder_test.cpp
+++ b/test/bej_decoder_test.cpp
@@ -189,7 +189,7 @@
{"DummySimple", dummySimpleTestFiles},
}),
[](const testing::TestParamInfo<BejDecoderTest::ParamType>& info) {
- return info.param.testName;
+ return info.param.testName;
});
} // namespace libbej