Closed
Description
Given the following configuration:
.clang-format
---
AccessModifierOffset: -4
AlignAfterOpenBracket: BlockIndent
AlignArrayOfStructures: None
AlignConsecutiveAssignments: None
AlignConsecutiveBitFields: None
AlignConsecutiveDeclarations: None
AlignConsecutiveMacros: None
AlignEscapedNewlines: Right
AlignOperands: DontAlign
AlignTrailingComments: false
AllowAllArgumentsOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: false
AllowShortBlocksOnASingleLine: Empty
AllowShortCaseLabelsOnASingleLine: false
AllowShortEnumsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: Never
AllowShortLambdasOnASingleLine: None
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: MultiLine
AttributeMacros:
- __capability
BinPackArguments: false
BinPackParameters: false
BitFieldColonSpacing: Both
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: Never
AfterEnum: false
AfterExternBlock: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
BeforeCatch: false
BeforeElse: false
BeforeLambdaBody: false
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyNamespace: true
SplitEmptyRecord: true
BreakBeforeBinaryOperators: All
BreakBeforeBraces: Custom
BreakBeforeConceptDeclarations: false
BreakBeforeTernaryOperators: false
BreakConstructorInitializers: BeforeComma
BreakConstructorInitializersBeforeComma: false
BreakInheritanceList: BeforeColon
BreakStringLiterals: true
ColumnLimit: 100
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 8
ContinuationIndentWidth: 8
Cpp11BracedListStyle: true
DeriveLineEnding: true
DerivePointerAlignment: false
DisableFormat: false
EmptyLineAfterAccessModifier: Never
EmptyLineBeforeAccessModifier: LogicalBlock
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: false
ForEachMacros:
- LIST_FOREACH
- LIST_FOREACH_SAFE
- RTE_ETH_FOREACH_DEV
- RTE_LCORE_FOREACH
- SLIST_FOREACH
- SLIST_FOREACH_SAFE
- STAILQ_FOREACH
- STAILQ_FOREACH_SAFE
- TAILQ_FOREACH
- TAILQ_FOREACH_SAFE
- rte_graph_foreach_node
- gr_vec_foreach
- gr_vec_foreach_ref
- gr_nh_flags_foreach
IfMacros:
- KJ_IF_MAYBE
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^".*'
Priority: -1
- Regex: '^<(gr_|gr\.)'
Priority: 100
- Regex: '^<(rte_|event|ecoli|numa.h|libsmartcols.h)'
Priority: 500
- Regex: '^<cmocka'
Priority: 100000
- Regex: '^<'
Priority: 10000
IncludeIsMainRegex: '(Test)?$'
IncludeIsMainSourceRegex: ''
IndentAccessModifiers: false
IndentCaseBlocks: false
IndentCaseLabels: false
IndentExternBlock: AfterExternBlock
IndentGotoLabels: false
IndentPPDirectives: None
IndentRequires: false
IndentWidth: 8
IndentWrappedFunctionNames: false
InsertTrailingCommas: Wrapped
KeepEmptyLinesAtTheStartOfBlocks: false
LambdaBodyIndentation: Signature
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: Inner
ObjCBinPackProtocolList: Auto
ObjCBlockIndentWidth: 4
ObjCBreakBeforeNestedBlockParam: true
ObjCSpaceAfterProperty: true
ObjCSpaceBeforeProtocolList: true
PPIndentWidth: -1
PackConstructorInitializers: BinPack
PenaltyBreakAssignment: 100000000
PenaltyBreakBeforeFirstCallParameter: 0
PenaltyBreakComment: 20
PenaltyBreakFirstLessLess: 120
PenaltyBreakOpenParenthesis: 400
PenaltyBreakString: 100
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 100000
PenaltyIndentedWhitespace: 1000
PenaltyReturnTypeOnItsOwnLine: 100
PointerAlignment: Right
QualifierAlignment: Leave
ReferenceAlignment: Pointer
ReflowComments: false
RemoveBracesLLVM: false
SeparateDefinitionBlocks: Leave
ShortNamespaceLines: 1
SortIncludes: CaseSensitive
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceAroundPointerQualifiers: Default
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeforeCpp11BracedList: true
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeParensOptions:
AfterControlStatements: true
AfterForeachMacros: true
AfterFunctionDeclarationName: false
AfterFunctionDefinitionName: false
AfterIfMacros: true
BeforeNonEmptyParentheses: false
SpaceBeforeRangeBasedForLoopColon: true
SpaceBeforeSquareBrackets: false
SpaceInEmptyBlock: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: Never
SpacesInCStyleCastParentheses: false
SpacesInConditionalStatement: false
SpacesInContainerLiterals: true
SpacesInLineCommentPrefix:
Minimum: 1
Maximum: -1
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: c++20
StatementAttributeLikeMacros:
- Q_EMIT
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
TabWidth: 8
UseCRLF: false
UseTab: Always
WhitespaceSensitiveMacros:
- BOOST_PP_STRINGIZE
- CF_SWIFT_NAME
- NS_SWIFT_NAME
- PP_STRINGIZE
- STRINGIZE
...
And this example file (formatted with clang-format 19):
#include <stddef.h>
#include <stdint.h>
#define ICMP6_ERR_DEST_UNREACH 2
struct rte_mbuf;
struct icmp6_err_dest_unreach {
int foo;
};
char *rte_pktmbuf_prepend(struct rte_mbuf *m, uint16_t len);
void test(struct rte_mbuf *mbuf, int icmp_type);
void test(struct rte_mbuf *mbuf, int icmp_type) {
struct icmp6_err_dest_unreach *du;
if (mbuf != NULL) {
switch (icmp_type) {
case ICMP6_ERR_DEST_UNREACH:
du = (struct icmp6_err_dest_unreach *)
rte_pktmbuf_prepend(mbuf, sizeof(*du));
break;
}
}
}
When formatting it with clang-format 20 (same configuration), I get a different result:
--- clang-format-19.c
+++ clang-format-20.c
@@ -17,8 +17,8 @@ void test(struct rte_mbuf *mbuf, int icm
if (mbuf != NULL) {
switch (icmp_type) {
case ICMP6_ERR_DEST_UNREACH:
- du = (struct icmp6_err_dest_unreach *)
- rte_pktmbuf_prepend(mbuf, sizeof(*du));
+ du = (struct icmp6_err_dest_unreach *
+ )rte_pktmbuf_prepend(mbuf, sizeof(*du));
break;
}
}
Maybe I missed a new option but, this looks like a bug/regression.
Metadata
Metadata
Assignees
Type
Projects
Status
Done