Skip to content

Commit 9625ef9

Browse files
chenhengqidanielocfb
authored andcommitted
Adopt .clang-format from kernel tree for BPF code
This is done by removing the ForEachMacros setting and adding the InsertNewlineAtEOF option. Signed-off-by: Hengqi Chen <[email protected]>
1 parent 9d617b0 commit 9625ef9

File tree

1 file changed

+120
-0
lines changed

1 file changed

+120
-0
lines changed

.clang-format

+120
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
# SPDX-License-Identifier: GPL-2.0
2+
#
3+
# clang-format configuration file. Intended for clang-format >= 11.
4+
#
5+
# For more information, see:
6+
#
7+
# Documentation/dev-tools/clang-format.rst
8+
# https://clang.llvm.org/docs/ClangFormat.html
9+
# https://clang.llvm.org/docs/ClangFormatStyleOptions.html
10+
#
11+
---
12+
AccessModifierOffset: -4
13+
AlignAfterOpenBracket: Align
14+
AlignConsecutiveAssignments: false
15+
AlignConsecutiveDeclarations: false
16+
AlignEscapedNewlines: Left
17+
AlignOperands: true
18+
AlignTrailingComments: false
19+
AllowAllParametersOfDeclarationOnNextLine: false
20+
AllowShortBlocksOnASingleLine: false
21+
AllowShortCaseLabelsOnASingleLine: false
22+
AllowShortFunctionsOnASingleLine: None
23+
AllowShortIfStatementsOnASingleLine: false
24+
AllowShortLoopsOnASingleLine: false
25+
AlwaysBreakAfterDefinitionReturnType: None
26+
AlwaysBreakAfterReturnType: None
27+
AlwaysBreakBeforeMultilineStrings: false
28+
AlwaysBreakTemplateDeclarations: false
29+
BinPackArguments: true
30+
BinPackParameters: true
31+
BraceWrapping:
32+
AfterClass: false
33+
AfterControlStatement: false
34+
AfterEnum: false
35+
AfterFunction: true
36+
AfterNamespace: true
37+
AfterObjCDeclaration: false
38+
AfterStruct: false
39+
AfterUnion: false
40+
AfterExternBlock: false
41+
BeforeCatch: false
42+
BeforeElse: false
43+
IndentBraces: false
44+
SplitEmptyFunction: true
45+
SplitEmptyRecord: true
46+
SplitEmptyNamespace: true
47+
BreakBeforeBinaryOperators: None
48+
BreakBeforeBraces: Custom
49+
BreakBeforeInheritanceComma: false
50+
BreakBeforeTernaryOperators: false
51+
BreakConstructorInitializersBeforeComma: false
52+
BreakConstructorInitializers: BeforeComma
53+
BreakAfterJavaFieldAnnotations: false
54+
BreakStringLiterals: false
55+
ColumnLimit: 80
56+
CommentPragmas: '^ IWYU pragma:'
57+
CompactNamespaces: false
58+
ConstructorInitializerAllOnOneLineOrOnePerLine: false
59+
ConstructorInitializerIndentWidth: 8
60+
ContinuationIndentWidth: 8
61+
Cpp11BracedListStyle: false
62+
DerivePointerAlignment: false
63+
DisableFormat: false
64+
ExperimentalAutoDetectBinPacking: false
65+
FixNamespaceComments: false
66+
67+
IncludeBlocks: Preserve
68+
IncludeCategories:
69+
- Regex: '.*'
70+
Priority: 1
71+
IncludeIsMainRegex: '(Test)?$'
72+
IndentCaseLabels: false
73+
IndentGotoLabels: false
74+
IndentPPDirectives: None
75+
IndentWidth: 8
76+
IndentWrappedFunctionNames: false
77+
JavaScriptQuotes: Leave
78+
JavaScriptWrapImports: true
79+
KeepEmptyLinesAtTheStartOfBlocks: false
80+
MacroBlockBegin: ''
81+
MacroBlockEnd: ''
82+
MaxEmptyLinesToKeep: 1
83+
NamespaceIndentation: None
84+
ObjCBinPackProtocolList: Auto
85+
ObjCBlockIndentWidth: 8
86+
ObjCSpaceAfterProperty: true
87+
ObjCSpaceBeforeProtocolList: true
88+
89+
# Taken from git's rules
90+
PenaltyBreakAssignment: 10
91+
PenaltyBreakBeforeFirstCallParameter: 30
92+
PenaltyBreakComment: 10
93+
PenaltyBreakFirstLessLess: 0
94+
PenaltyBreakString: 10
95+
PenaltyExcessCharacter: 100
96+
PenaltyReturnTypeOnItsOwnLine: 60
97+
98+
PointerAlignment: Right
99+
ReflowComments: false
100+
SortIncludes: false
101+
SortUsingDeclarations: false
102+
SpaceAfterCStyleCast: false
103+
SpaceAfterTemplateKeyword: true
104+
SpaceBeforeAssignmentOperators: true
105+
SpaceBeforeCtorInitializerColon: true
106+
SpaceBeforeInheritanceColon: true
107+
SpaceBeforeParens: ControlStatementsExceptForEachMacros
108+
SpaceBeforeRangeBasedForLoopColon: true
109+
SpaceInEmptyParentheses: false
110+
SpacesBeforeTrailingComments: 1
111+
SpacesInAngles: false
112+
SpacesInContainerLiterals: false
113+
SpacesInCStyleCastParentheses: false
114+
SpacesInParentheses: false
115+
SpacesInSquareBrackets: false
116+
Standard: Cpp03
117+
TabWidth: 8
118+
UseTab: Always
119+
InsertNewlineAtEOF: true
120+
...

0 commit comments

Comments
 (0)