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.
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.
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.
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/>.
19 # Requires clang-format version >= 11.0
21 # For more information, see:
23 # https://clang.llvm.org/docs/ClangFormat.html
24 # https://clang.llvm.org/docs/ClangFormatStyleOptions.html
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.
31 # To format the current git diff inplace (-i) the follow command can
33 # $> git diff -U0 --no-color HEAD^ | clang-format-diff -i -p1
35 # To just view the diff clang-format would generate:
36 # $> git diff -U0 --no-color HEAD^ | clang-format-diff -p1
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/
42 # Based on autogenerated format from:
43 # $> clang-format --style=GNU -dump-config
45 AccessModifierOffset: -2
46 AlignAfterOpenBracket: Align
47 AlignConsecutiveMacros: false
48 AlignConsecutiveAssignments: false
49 AlignConsecutiveBitFields: false
50 AlignConsecutiveDeclarations: false
51 AlignEscapedNewlines: Right
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
71 AfterControlStatement: true
77 AfterExternBlock: 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
92 CommentPragmas: '^ IWYU pragma:'
93 CompactNamespaces: false
94 ContinuationIndentWidth: 4
95 Cpp11BracedListStyle: false
96 DeriveLineEnding: true
97 DerivePointerAlignment: false
99 ExperimentalAutoDetectBinPacking: false
100 FixNamespaceComments: false
101 IncludeBlocks: Preserve
105 IncludeIsMainRegex: '(Test)?$'
106 IndentCaseLabels: false
107 IndentCaseBlocks: false
108 IndentGotoLabels: true
110 IndentPPDirectives: AfterHash
111 IndentExternBlock: AfterExternBlock
112 IndentWrappedFunctionNames: false
113 InsertTrailingCommas: None
114 KeepEmptyLinesAtTheStartOfBlocks: true
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
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
154 - 'list_for_each_prev'
155 - 'list_for_each_prev_safe'