X Tutup
Skip to content

Commit f3a604e

Browse files
zebastianpoettering
authored andcommitted
Add .clang-format file
The result of automatic formatting is not perfect, but if someone uses an editor that uses that, it's probably better than nothing. Fixes systemd#15415. [zjs: I resurrected this patch from systemd#11811 and edited the extended comment heavily.]
1 parent 4444e85 commit f3a604e

File tree

1 file changed

+112
-0
lines changed

1 file changed

+112
-0
lines changed

.clang-format

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
# This configuration file can be used to auto-format the code base.
2+
# Not all guidelines specified in CODING_STYLE are followed, so the
3+
# result MUST NOT be committed indiscriminately, but each automated
4+
# change should be reviewed and only the appropriate ones commited.
5+
#
6+
# To apply the coding style you can run the following command (assuming you
7+
# installed clang-format on your system):
8+
#
9+
# $ git ls-files 'src/*.[ch]' 'src/*.cc' | xargs clang-format -i -style=file
10+
# You can find more information on the different config parameters in this file here:
11+
# https://clang.llvm.org/docs/ClangFormatStyleOptions.html
12+
---
13+
AccessModifierOffset: -4
14+
AlignAfterOpenBracket: AlwaysBreak
15+
AlignEscapedNewlines: Left
16+
AlignOperands: false
17+
AllowShortFunctionsOnASingleLine: None
18+
AlwaysBreakBeforeMultilineStrings: true
19+
AlwaysBreakTemplateDeclarations: Yes
20+
BinPackArguments: false
21+
BinPackParameters: false
22+
BraceWrapping:
23+
AfterEnum: true
24+
SplitEmptyFunction: false
25+
SplitEmptyRecord: false
26+
SplitEmptyNamespace: false
27+
BreakBeforeBraces: Custom
28+
BreakInheritanceList: BeforeComma
29+
BreakBeforeTernaryOperators: false
30+
BreakStringLiterals: false
31+
ColumnLimit: 109
32+
CompactNamespaces: true
33+
ConstructorInitializerAllOnOneLineOrOnePerLine: true
34+
ConstructorInitializerIndentWidth: 8
35+
ContinuationIndentWidth: 8
36+
Cpp11BracedListStyle: false
37+
ForEachMacros:
38+
- BITMAP_FOREACH
39+
- CMSG_FOREACH
40+
- _DNS_ANSWER_FOREACH
41+
- DNS_ANSWER_FOREACH
42+
- _DNS_ANSWER_FOREACH_FLAGS
43+
- DNS_ANSWER_FOREACH_FLAGS
44+
- _DNS_ANSWER_FOREACH_FULL
45+
- DNS_ANSWER_FOREACH_FULL
46+
- _DNS_ANSWER_FOREACH_IFINDEX
47+
- DNS_ANSWER_FOREACH_IFINDEX
48+
- _DNS_QUESTION_FOREACH
49+
- DNS_QUESTION_FOREACH
50+
- FDSET_FOREACH
51+
- FOREACH_BTRFS_IOCTL_SEARCH_HEADER
52+
- FOREACH_DEVICE
53+
- FOREACH_DEVICE_AND_SUBSYSTEM
54+
- FOREACH_DEVICE_DEVLINK
55+
- FOREACH_DEVICE_PROPERTY
56+
- FOREACH_DEVICE_SYSATTR
57+
- FOREACH_DEVICE_TAG
58+
- FOREACH_DIRENT
59+
- FOREACH_DIRENT_ALL
60+
- FOREACH_INOTIFY_EVENT
61+
- FOREACH_STRING
62+
- FOREACH_SUBSYSTEM
63+
- _FOREACH_WORD
64+
- FOREACH_WORD
65+
- FOREACH_WORD_SEPARATOR
66+
- HASHMAP_FOREACH
67+
- HASHMAP_FOREACH_IDX
68+
- HASHMAP_FOREACH_KEY
69+
- JOURNAL_FOREACH_DATA_RETVAL
70+
- JSON_VARIANT_ARRAY_FOREACH
71+
- JSON_VARIANT_OBJECT_FOREACH
72+
- LIST_FOREACH
73+
- LIST_FOREACH_AFTER
74+
- LIST_FOREACH_BEFORE
75+
- LIST_FOREACH_OTHERS
76+
- LIST_FOREACH_SAFE
77+
- MESSAGE_FOREACH_PART
78+
- NULSTR_FOREACH
79+
- NULSTR_FOREACH_PAIR
80+
- OBJECT_PATH_FOREACH_PREFIX
81+
- ORDERED_HASHMAP_FOREACH
82+
- ORDERED_HASHMAP_FOREACH_KEY
83+
- ORDERED_SET_FOREACH
84+
- PATH_FOREACH_PREFIX
85+
- PATH_FOREACH_PREFIX_MORE
86+
- SD_HWDB_FOREACH_PROPERTY
87+
- SD_JOURNAL_FOREACH
88+
- SD_JOURNAL_FOREACH_BACKWARDS
89+
- SD_JOURNAL_FOREACH_DATA
90+
- SD_JOURNAL_FOREACH_FIELD
91+
- SD_JOURNAL_FOREACH_UNIQUE
92+
- SECCOMP_FOREACH_LOCAL_ARCH
93+
- SET_FOREACH
94+
- SET_FOREACH_MOVE
95+
- STRV_FOREACH
96+
- STRV_FOREACH_BACKWARDS
97+
- STRV_FOREACH_PAIR
98+
IndentPPDirectives: AfterHash
99+
IndentWidth: 8
100+
IndentWrappedFunctionNames: true
101+
MaxEmptyLinesToKeep: 2
102+
PenaltyBreakAssignment: 65
103+
PenaltyBreakBeforeFirstCallParameter: 16
104+
PenaltyBreakComment: 320
105+
PenaltyBreakFirstLessLess: 50
106+
PenaltyBreakString: 0
107+
PenaltyExcessCharacter: 10
108+
PenaltyReturnTypeOnItsOwnLine: 100
109+
SpaceAfterCStyleCast: true
110+
SpacesInAngles: true
111+
TabWidth: 8
112+
UseCRLF: false

0 commit comments

Comments
 (0)
X Tutup