-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy path.clang-format
More file actions
102 lines (92 loc) · 2.53 KB
/
Copy path.clang-format
File metadata and controls
102 lines (92 loc) · 2.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# SPDX-License-Identifier: GPL-2.0-only
#
# https://www.kernel.org/doc/html/v4.18/process/clang-format.html
# https://clang.llvm.org/docs/ClangFormatStyleOptions.html
---
BasedOnStyle: LLVM
# Dimensions
ColumnLimit: 80
IndentWidth: 8
ContinuationIndentWidth: 8
TabWidth: 8
UseTab: Always
# Brace placement
BreakBeforeBraces: Custom
BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: true
AfterNamespace: true
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
# Never collapse this:
# block, case, function, if or loop onto one line
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortEnumsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
# Parameter / argument wrapping
AlignAfterOpenBracket: Align
AllowAllArgumentsOnNextLine: false
AllowAllParametersOfDeclarationOnNextLine: false
BinPackArguments: true
BinPackParameters: true
AlignOperands: Align
AlignEscapedNewlines: Left
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignTrailingComments:
Kind: Never
# Pointer binds to the identifier: `int *p`
DerivePointerAlignment: false
PointerAlignment: Right
# Spacing
SpaceAfterCStyleCast: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatementsExceptControlMacros
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInParentheses: false
SpacesInSquareBrackets: false
SpacesInCStyleCastParentheses: false
# Comments, includes, blank lines
CommentPragmas: '^ IWYU pragma:'
ReflowComments: false
SortIncludes: false
IncludeBlocks: Preserve
KeepEmptyLinesAtTheStartOfBlocks: false
MaxEmptyLinesToKeep: 1
# Statement
BreakBeforeBinaryOperators: None
BreakBeforeTernaryOperators: false
BreakStringLiterals: false
Cpp11BracedListStyle: false
IndentCaseLabels: false
IndentGotoLabels: false
IndentPPDirectives: None
IndentWrappedFunctionNames: false
# Iterator macros that take a loop body (libbpf):
# treat like a for loop
ForEachMacros:
- 'bpf_object__for_each_program'
- 'bpf_object__for_each_map'
# Penalties
# Taken from the Linux kernel & git configuration
PenaltyBreakAssignment: 10
PenaltyBreakBeforeFirstCallParameter: 30
PenaltyBreakComment: 10
PenaltyBreakFirstLessLess: 0
PenaltyBreakString: 10
PenaltyExcessCharacter: 100
PenaltyReturnTypeOnItsOwnLine: 60
...