summaryrefslogtreecommitdiffstats
path: root/.clang-format
diff options
context:
space:
mode:
authorSebastian Jennen <sebastian.t.jennen@gmail.com>2020-04-16 12:48:42 +0200
committerLennart Poettering <lennart@poettering.net>2020-04-17 15:54:17 +0200
commitf3a604e4cf84f00a595aceca6c3e78fd03de652d (patch)
tree60b32792d83f8cfe90fb06818d91a395945b8f0b /.clang-format
parentMerge pull request #15454 from keszybz/codespell-fixes (diff)
downloadsystemd-f3a604e4cf84f00a595aceca6c3e78fd03de652d.tar.xz
systemd-f3a604e4cf84f00a595aceca6c3e78fd03de652d.zip
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 #15415. [zjs: I resurrected this patch from #11811 and edited the extended comment heavily.]
Diffstat (limited to '.clang-format')
-rw-r--r--.clang-format112
1 files changed, 112 insertions, 0 deletions
diff --git a/.clang-format b/.clang-format
new file mode 100644
index 0000000000..ef7c918d4e
--- /dev/null
+++ b/.clang-format
@@ -0,0 +1,112 @@
+# This configuration file can be used to auto-format the code base.
+# Not all guidelines specified in CODING_STYLE are followed, so the
+# result MUST NOT be committed indiscriminately, but each automated
+# change should be reviewed and only the appropriate ones commited.
+#
+# To apply the coding style you can run the following command (assuming you
+# installed clang-format on your system):
+#
+# $ git ls-files 'src/*.[ch]' 'src/*.cc' | xargs clang-format -i -style=file
+# You can find more information on the different config parameters in this file here:
+# https://clang.llvm.org/docs/ClangFormatStyleOptions.html
+---
+AccessModifierOffset: -4
+AlignAfterOpenBracket: AlwaysBreak
+AlignEscapedNewlines: Left
+AlignOperands: false
+AllowShortFunctionsOnASingleLine: None
+AlwaysBreakBeforeMultilineStrings: true
+AlwaysBreakTemplateDeclarations: Yes
+BinPackArguments: false
+BinPackParameters: false
+BraceWrapping:
+ AfterEnum: true
+ SplitEmptyFunction: false
+ SplitEmptyRecord: false
+ SplitEmptyNamespace: false
+BreakBeforeBraces: Custom
+BreakInheritanceList: BeforeComma
+BreakBeforeTernaryOperators: false
+BreakStringLiterals: false
+ColumnLimit: 109
+CompactNamespaces: true
+ConstructorInitializerAllOnOneLineOrOnePerLine: true
+ConstructorInitializerIndentWidth: 8
+ContinuationIndentWidth: 8
+Cpp11BracedListStyle: false
+ForEachMacros:
+ - BITMAP_FOREACH
+ - CMSG_FOREACH
+ - _DNS_ANSWER_FOREACH
+ - DNS_ANSWER_FOREACH
+ - _DNS_ANSWER_FOREACH_FLAGS
+ - DNS_ANSWER_FOREACH_FLAGS
+ - _DNS_ANSWER_FOREACH_FULL
+ - DNS_ANSWER_FOREACH_FULL
+ - _DNS_ANSWER_FOREACH_IFINDEX
+ - DNS_ANSWER_FOREACH_IFINDEX
+ - _DNS_QUESTION_FOREACH
+ - DNS_QUESTION_FOREACH
+ - FDSET_FOREACH
+ - FOREACH_BTRFS_IOCTL_SEARCH_HEADER
+ - FOREACH_DEVICE
+ - FOREACH_DEVICE_AND_SUBSYSTEM
+ - FOREACH_DEVICE_DEVLINK
+ - FOREACH_DEVICE_PROPERTY
+ - FOREACH_DEVICE_SYSATTR
+ - FOREACH_DEVICE_TAG
+ - FOREACH_DIRENT
+ - FOREACH_DIRENT_ALL
+ - FOREACH_INOTIFY_EVENT
+ - FOREACH_STRING
+ - FOREACH_SUBSYSTEM
+ - _FOREACH_WORD
+ - FOREACH_WORD
+ - FOREACH_WORD_SEPARATOR
+ - HASHMAP_FOREACH
+ - HASHMAP_FOREACH_IDX
+ - HASHMAP_FOREACH_KEY
+ - JOURNAL_FOREACH_DATA_RETVAL
+ - JSON_VARIANT_ARRAY_FOREACH
+ - JSON_VARIANT_OBJECT_FOREACH
+ - LIST_FOREACH
+ - LIST_FOREACH_AFTER
+ - LIST_FOREACH_BEFORE
+ - LIST_FOREACH_OTHERS
+ - LIST_FOREACH_SAFE
+ - MESSAGE_FOREACH_PART
+ - NULSTR_FOREACH
+ - NULSTR_FOREACH_PAIR
+ - OBJECT_PATH_FOREACH_PREFIX
+ - ORDERED_HASHMAP_FOREACH
+ - ORDERED_HASHMAP_FOREACH_KEY
+ - ORDERED_SET_FOREACH
+ - PATH_FOREACH_PREFIX
+ - PATH_FOREACH_PREFIX_MORE
+ - SD_HWDB_FOREACH_PROPERTY
+ - SD_JOURNAL_FOREACH
+ - SD_JOURNAL_FOREACH_BACKWARDS
+ - SD_JOURNAL_FOREACH_DATA
+ - SD_JOURNAL_FOREACH_FIELD
+ - SD_JOURNAL_FOREACH_UNIQUE
+ - SECCOMP_FOREACH_LOCAL_ARCH
+ - SET_FOREACH
+ - SET_FOREACH_MOVE
+ - STRV_FOREACH
+ - STRV_FOREACH_BACKWARDS
+ - STRV_FOREACH_PAIR
+IndentPPDirectives: AfterHash
+IndentWidth: 8
+IndentWrappedFunctionNames: true
+MaxEmptyLinesToKeep: 2
+PenaltyBreakAssignment: 65
+PenaltyBreakBeforeFirstCallParameter: 16
+PenaltyBreakComment: 320
+PenaltyBreakFirstLessLess: 50
+PenaltyBreakString: 0
+PenaltyExcessCharacter: 10
+PenaltyReturnTypeOnItsOwnLine: 100
+SpaceAfterCStyleCast: true
+SpacesInAngles: true
+TabWidth: 8
+UseCRLF: false