]> git.ipfire.org Git - thirdparty/glibc.git/blob - .clang-format
INSTALL, install.texi: minor updates, regenerate
[thirdparty/glibc.git] / .clang-format
1 # clang-format file for GLIBC
2 # Copyright (C) 2022-2024 Free Software Foundation, Inc.
3 # This file is part of the GNU C Library.
4 #
5 # The GNU C Library is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU Lesser General Public
7 # License as published by the Free Software Foundation; either
8 # version 2.1 of the License, or (at your option) any later version.
9 #
10 # The GNU C Library is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # Lesser General Public License for more details.
14 #
15 # You should have received a copy of the GNU Lesser General Public
16 # License along with the GNU C Library; if not, see
17 # <https://www.gnu.org/licenses/>.
18 #
19 # Requires clang-format version >= 11.0
20 #
21 # For more information, see:
22 #
23 # https://clang.llvm.org/docs/ClangFormat.html
24 # https://clang.llvm.org/docs/ClangFormatStyleOptions.html
25 #
26 # There are some known cases that this doesn't produce the desired
27 # style (i.e Preprocessor Directives are over-indented and not
28 # auto-commented). As a result, this is meant to be a utility to make
29 # formatting easier, not a definitive standard.
30 #
31 # To format the current git diff inplace (-i) the follow command can
32 # be used:
33 # $> git diff -U0 --no-color HEAD^ | clang-format-diff -i -p1
34 #
35 # To just view the diff clang-format would generate:
36 # $> git diff -U0 --no-color HEAD^ | clang-format-diff -p1
37 #
38 # NB: clang-format-diff, along with other clang-format related tools,
39 # can be found at: /path/to/llvm-project/clang/tools/clang-format/
40 #
41 #
42 # Based on autogenerated format from:
43 # $> clang-format --style=GNU -dump-config
44 ---
45 AccessModifierOffset: -2
46 AlignAfterOpenBracket: Align
47 AlignConsecutiveMacros: false
48 AlignConsecutiveAssignments: false
49 AlignConsecutiveBitFields: false
50 AlignConsecutiveDeclarations: false
51 AlignEscapedNewlines: Right
52 AlignOperands: true
53 AlignTrailingComments: true
54 AllowAllArgumentsOnNextLine: true
55 AllowAllParametersOfDeclarationOnNextLine: true
56 AllowShortEnumsOnASingleLine: true
57 AllowShortBlocksOnASingleLine: false
58 AllowShortCaseLabelsOnASingleLine: false
59 AllowShortFunctionsOnASingleLine: All
60 AllowShortLambdasOnASingleLine: All
61 AllowShortIfStatementsOnASingleLine: Never
62 AllowShortLoopsOnASingleLine: false
63 AlwaysBreakAfterDefinitionReturnType: All
64 AlwaysBreakAfterReturnType: AllDefinitions
65 AlwaysBreakBeforeMultilineStrings: false
66 BinPackArguments: true
67 BinPackParameters: true
68 BraceWrapping:
69 AfterCaseLabel: true
70 AfterClass: true
71 AfterControlStatement: true
72 AfterEnum: true
73 AfterFunction: true
74 AfterNamespace: true
75 AfterStruct: true
76 AfterUnion: true
77 AfterExternBlock: true
78 BeforeCatch: true
79 BeforeElse: true
80 BeforeWhile: true
81 IndentBraces: true
82 SplitEmptyFunction: true
83 SplitEmptyRecord: true
84 SplitEmptyNamespace: true
85 BreakBeforeBinaryOperators: All
86 BreakBeforeBraces: GNU
87 BreakBeforeInheritanceComma: false
88 BreakInheritanceList: BeforeColon
89 BreakBeforeTernaryOperators: true
90 BreakStringLiterals: true
91 ColumnLimit: 79
92 CommentPragmas: '^ IWYU pragma:'
93 CompactNamespaces: false
94 ContinuationIndentWidth: 4
95 Cpp11BracedListStyle: false
96 DeriveLineEnding: true
97 DerivePointerAlignment: false
98 DisableFormat: false
99 ExperimentalAutoDetectBinPacking: false
100 FixNamespaceComments: false
101 IncludeBlocks: Preserve
102 IncludeCategories:
103 - Regex: '.*'
104 Priority: 1
105 IncludeIsMainRegex: '(Test)?$'
106 IndentCaseLabels: false
107 IndentCaseBlocks: false
108 IndentGotoLabels: true
109 IndentWidth: 2
110 IndentPPDirectives: AfterHash
111 IndentExternBlock: AfterExternBlock
112 IndentWrappedFunctionNames: false
113 InsertTrailingCommas: None
114 KeepEmptyLinesAtTheStartOfBlocks: true
115 MacroBlockBegin: ''
116 MacroBlockEnd: ''
117 MaxEmptyLinesToKeep: 1
118 NamespaceIndentation: None
119 PenaltyBreakAssignment: 2
120 PenaltyBreakBeforeFirstCallParameter: 19
121 PenaltyBreakComment: 300
122 PenaltyBreakFirstLessLess: 120
123 PenaltyBreakString: 1000
124 PenaltyExcessCharacter: 1000000
125 PenaltyReturnTypeOnItsOwnLine: 60
126 PointerAlignment: Right
127 ReflowComments: true
128 SortIncludes: false
129 SortUsingDeclarations: true
130 SpaceAfterCStyleCast: true
131 SpaceAfterLogicalNot: false
132 SpaceBeforeAssignmentOperators: true
133 SpaceBeforeCpp11BracedList: false
134 SpaceBeforeCtorInitializerColon: true
135 SpaceBeforeInheritanceColon: true
136 SpaceBeforeParens: Always
137 SpaceBeforeRangeBasedForLoopColon: true
138 SpaceInEmptyBlock: false
139 SpaceInEmptyParentheses: false
140 SpacesBeforeTrailingComments: 1
141 SpacesInAngles: false
142 SpacesInConditionalStatement: false
143 SpacesInContainerLiterals: true
144 SpacesInCStyleCastParentheses: false
145 SpacesInParentheses: false
146 SpacesInSquareBrackets: false
147 SpaceBeforeSquareBrackets: false
148 Standard: Cpp03
149 TabWidth: 8
150 UseTab: Always
151 ForEachMacros:
152 - 'FOR_EACH_IMPL'
153 - 'list_for_each'
154 - 'list_for_each_prev'
155 - 'list_for_each_prev_safe'
156 ...