-
Notifications
You must be signed in to change notification settings - Fork 93
/
.clang-format
81 lines (59 loc) · 2.5 KB
/
.clang-format
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
# OpenSSL formatting is close to Linux Kernel's , which is close
# to LLVM's.
BasedOnStyle: LLVM
# The following rules tries to reproduce the OpenSSL coding style defined
# in the following document: https://www.openssl.org/policies/technical/coding-style.html
# Chapter 1: Indentation.
## Use 4 space characters, not tabs.
UseTab: Never
IndentWidth: 4
## Pre-processor directives use one space for indents, after hash.
IndentPPDirectives: AfterHash
# This option seems to be broken on clang-format-14, but fixed in clang-format-15.
# We keep it disabled for now.
#PPIndentWidth: 1
# Chapter 2: Breaking long lines and strings
## Don’t put multiple statements, or assignments, on a single line.
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortEnumsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AllowAllParametersOfDeclarationOnNextLine: false
## The limit on the length of lines is 80 columns.
ColumnLimit: 80
# Descendants are always substantially shorter than the parent and are placed substantially to the right.
AlignAfterOpenBracket: Align
AlignOperands: Align
BreakBeforeBinaryOperators: true
# Never break user-visible strings, however, because that breaks the ability to grep for them.
BreakStringLiterals: false
# Chapter 3: Placing Braces and Spaces
SpaceBeforeAssignmentOperators: true
# Use the same indentation level as for the switch statement.
IndentCaseLabels: false
## […] is to put the opening brace last on the line, and the closing brace first
BreakBeforeBraces: Custom
BraceWrapping:
AfterClass: false
AfterControlStatement: Never
AfterEnum: false
## There is one special case, however. Functions have the opening brace at the beginning of the next line
AfterFunction: true
AfterNamespace: false
AfterStruct: false
AfterUnion: false
BeforeCatch: false
BeforeElse: false
BeforeWhile: false
# Chapter 3.1: Spaces
## When declaring pointer data or a function that returns a pointer type, the asterisk goes next to the data or function name, and not the type:
PointerAlignment: Right
## Do not use multiple consecutive spaces except in comments, for indentation, and for multi-line alignment of definitions, e.g.:
AlignConsecutiveMacros: AcrossComments
# Chapter 9: Macros and Enums
## Macros with multiple statements should be enclosed in a do - while block
AlignEscapedNewlines: Left