Skip to content

Commit 8c72920

Browse files
committed
clang-format: tweaks
This commit makes the following changes: - Disallow single-line functions. This matches the dominant style used in Open MPI. - Increase the penalty for breaking on assigment slightly lower than breaking before first argument. That will ensure that long assignments of the form foo = bar(baz) will break after the = before trying to break after the open-paren. - Break before binary operators. This is a change in style that I will revert if there is any push back. This causes long statements to break before the binary operator not after it. This is the currently recommended practice. - Don't allow all arguments on the next line. This may cause a break after an open paren which is not desired. - Change AlignOperands to true (synonym for Align in v11+) to support clang-format v10. Signed-off-by: Nathan Hjelm <hjelmn@google.com>
1 parent 09eb050 commit 8c72920

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

.clang-format

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,15 @@ AlignConsecutiveAssignments: false
3636
AlignConsecutiveBitFields: false
3737
AlignConsecutiveDeclarations: false
3838
AlignEscapedNewlines: Left
39-
AlignOperands: Align
39+
AlignOperands: true
4040
AlignTrailingComments: true
41-
AllowAllArgumentsOnNextLine: true
41+
AllowAllArgumentsOnNextLine: false
4242
AllowAllConstructorInitializersOnNextLine: true
4343
AllowAllParametersOfDeclarationOnNextLine: true
4444
AllowShortEnumsOnASingleLine: true
4545
AllowShortBlocksOnASingleLine: Never
4646
AllowShortCaseLabelsOnASingleLine: false
47-
AllowShortFunctionsOnASingleLine: All
47+
AllowShortFunctionsOnASingleLine: None
4848
AllowShortLambdasOnASingleLine: All
4949
AllowShortIfStatementsOnASingleLine: Never
5050
AllowShortLoopsOnASingleLine: false
@@ -73,7 +73,7 @@ BraceWrapping:
7373
SplitEmptyFunction: true
7474
SplitEmptyRecord: true
7575
SplitEmptyNamespace: true
76-
BreakBeforeBinaryOperators: None
76+
BreakBeforeBinaryOperators: true
7777
BreakBeforeBraces: Custom
7878
BreakBeforeInheritanceComma: false
7979
BreakInheritanceList: BeforeColon
@@ -92,7 +92,6 @@ Cpp11BracedListStyle: true
9292
DeriveLineEnding: true
9393
DerivePointerAlignment: false
9494
DisableFormat: false
95-
ExperimentalAutoDetectBinPacking: false
9695
FixNamespaceComments: true
9796
ForEachMacros:
9897
- foreach
@@ -139,8 +138,8 @@ ObjCBlockIndentWidth: 4
139138
ObjCBreakBeforeNestedBlockParam: true
140139
ObjCSpaceAfterProperty: false
141140
ObjCSpaceBeforeProtocolList: true
142-
PenaltyBreakAssignment: 300
143-
PenaltyBreakBeforeFirstCallParameter: 300
141+
PenaltyBreakAssignment: 250
142+
PenaltyBreakBeforeFirstCallParameter: 301
144143
PenaltyBreakComment: 300
145144
PenaltyBreakFirstLessLess: 120
146145
PenaltyBreakString: 1000

0 commit comments

Comments
 (0)