Skip to content

Commit 0d35f5c

Browse files
committed
Add a .clang_format file for Open MPI
This file works with clang-format --style=file to reformat code to match the style used in Open MPI. This type includes: - No tabs. They are not recommended for Open MPI and can often screw up the formatting. - Tab depth: 4. This is what is used throughout the Open MPI code base. - Max column width: 100. There currently is no standard for Open MPI but we should aim to use something reasonable. - Braces following function definitions occur un-indented on the following line. - Braces following other control statements occur on the same line as the control statement. - Spaces always before open parentheses. This is common accross the code base but not consistent. - Align consecutive macro definitions. Signed-off-by: Nathan Hjelm <[email protected]>
1 parent 8f8e9b8 commit 0d35f5c

File tree

1 file changed

+149
-0
lines changed

1 file changed

+149
-0
lines changed

.clang_format

Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
---
2+
Language: Cpp
3+
# BasedOnStyle: LLVM
4+
AccessModifierOffset: -2
5+
AlignAfterOpenBracket: Align
6+
AlignConsecutiveMacros: true
7+
AlignConsecutiveAssignments: true
8+
AlignConsecutiveBitFields: false
9+
AlignConsecutiveDeclarations: false
10+
AlignEscapedNewlines: Right
11+
AlignOperands: Align
12+
AlignTrailingComments: true
13+
AllowAllArgumentsOnNextLine: true
14+
AllowAllConstructorInitializersOnNextLine: true
15+
AllowAllParametersOfDeclarationOnNextLine: true
16+
AllowShortEnumsOnASingleLine: true
17+
AllowShortBlocksOnASingleLine: Never
18+
AllowShortCaseLabelsOnASingleLine: false
19+
AllowShortFunctionsOnASingleLine: All
20+
AllowShortLambdasOnASingleLine: All
21+
AllowShortIfStatementsOnASingleLine: Never
22+
AllowShortLoopsOnASingleLine: false
23+
AlwaysBreakAfterDefinitionReturnType: None
24+
AlwaysBreakAfterReturnType: None
25+
AlwaysBreakBeforeMultilineStrings: false
26+
AlwaysBreakTemplateDeclarations: MultiLine
27+
BinPackArguments: true
28+
BinPackParameters: true
29+
BraceWrapping:
30+
AfterCaseLabel: false
31+
AfterClass: false
32+
AfterControlStatement: Never
33+
AfterEnum: false
34+
AfterFunction: true
35+
AfterNamespace: false
36+
AfterObjCDeclaration: false
37+
AfterStruct: false
38+
AfterUnion: false
39+
AfterExternBlock: false
40+
BeforeCatch: false
41+
BeforeElse: false
42+
BeforeLambdaBody: false
43+
BeforeWhile: false
44+
IndentBraces: false
45+
SplitEmptyFunction: true
46+
SplitEmptyRecord: true
47+
SplitEmptyNamespace: true
48+
BreakBeforeBinaryOperators: None
49+
BreakBeforeBraces: Custom
50+
BreakBeforeInheritanceComma: false
51+
BreakInheritanceList: BeforeColon
52+
BreakBeforeTernaryOperators: true
53+
BreakConstructorInitializersBeforeComma: false
54+
BreakConstructorInitializers: BeforeColon
55+
BreakAfterJavaFieldAnnotations: false
56+
BreakStringLiterals: true
57+
ColumnLimit: 100
58+
CommentPragmas: '^ IWYU pragma:'
59+
CompactNamespaces: false
60+
ConstructorInitializerAllOnOneLineOrOnePerLine: false
61+
ConstructorInitializerIndentWidth: 4
62+
ContinuationIndentWidth: 4
63+
Cpp11BracedListStyle: true
64+
DeriveLineEnding: true
65+
DerivePointerAlignment: false
66+
DisableFormat: false
67+
ExperimentalAutoDetectBinPacking: false
68+
FixNamespaceComments: true
69+
ForEachMacros:
70+
- foreach
71+
- Q_FOREACH
72+
- BOOST_FOREACH
73+
IncludeBlocks: Preserve
74+
IncludeCategories:
75+
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
76+
Priority: 2
77+
SortPriority: 0
78+
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
79+
Priority: 3
80+
SortPriority: 0
81+
- Regex: '.*'
82+
Priority: 1
83+
SortPriority: 0
84+
IncludeIsMainRegex: '(Test)?$'
85+
IncludeIsMainSourceRegex: ''
86+
IndentCaseLabels: false
87+
IndentCaseBlocks: false
88+
IndentGotoLabels: true
89+
IndentPPDirectives: None
90+
IndentExternBlock: AfterExternBlock
91+
IndentWidth: 4
92+
IndentWrappedFunctionNames: false
93+
InsertTrailingCommas: None
94+
JavaScriptQuotes: Leave
95+
JavaScriptWrapImports: true
96+
KeepEmptyLinesAtTheStartOfBlocks: true
97+
MacroBlockBegin: ''
98+
MacroBlockEnd: ''
99+
MaxEmptyLinesToKeep: 1
100+
NamespaceIndentation: None
101+
ObjCBinPackProtocolList: Auto
102+
ObjCBlockIndentWidth: 4
103+
ObjCBreakBeforeNestedBlockParam: true
104+
ObjCSpaceAfterProperty: false
105+
ObjCSpaceBeforeProtocolList: true
106+
PenaltyBreakAssignment: 2
107+
PenaltyBreakBeforeFirstCallParameter: 19
108+
PenaltyBreakComment: 300
109+
PenaltyBreakFirstLessLess: 120
110+
PenaltyBreakString: 1000
111+
PenaltyBreakTemplateDeclaration: 10
112+
PenaltyExcessCharacter: 1000000
113+
PenaltyReturnTypeOnItsOwnLine: 60
114+
PointerAlignment: Right
115+
ReflowComments: true
116+
SortIncludes: true
117+
SortUsingDeclarations: true
118+
SpaceAfterCStyleCast: false
119+
SpaceAfterLogicalNot: false
120+
SpaceAfterTemplateKeyword: true
121+
SpaceBeforeAssignmentOperators: true
122+
SpaceBeforeCpp11BracedList: false
123+
SpaceBeforeCtorInitializerColon: true
124+
SpaceBeforeInheritanceColon: true
125+
SpaceBeforeParens: Always
126+
SpaceBeforeRangeBasedForLoopColon: true
127+
SpaceInEmptyBlock: false
128+
SpaceInEmptyParentheses: false
129+
SpacesBeforeTrailingComments: 1
130+
SpacesInAngles: false
131+
SpacesInConditionalStatement: false
132+
SpacesInContainerLiterals: true
133+
SpacesInCStyleCastParentheses: false
134+
SpacesInParentheses: false
135+
SpacesInSquareBrackets: false
136+
SpaceBeforeSquareBrackets: false
137+
Standard: Latest
138+
StatementMacros:
139+
- Q_UNUSED
140+
- QT_REQUIRE_VERSION
141+
TabWidth: 8
142+
UseCRLF: false
143+
UseTab: Never
144+
WhitespaceSensitiveMacros:
145+
- STRINGIZE
146+
- PP_STRINGIZE
147+
- BOOST_PP_STRINGIZE
148+
...
149+

0 commit comments

Comments
 (0)