]> git.ipfire.org Git - thirdparty/glibc.git/blame - .clang-format
NEWS: Add advisories.
[thirdparty/glibc.git] / .clang-format
CommitLineData
ac5f5a92 1# clang-format file for GLIBC
dff8da6b 2# Copyright (C) 2022-2024 Free Software Foundation, Inc.
ac5f5a92
NG
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---
45AccessModifierOffset: -2
46AlignAfterOpenBracket: Align
47AlignConsecutiveMacros: false
48AlignConsecutiveAssignments: false
49AlignConsecutiveBitFields: false
50AlignConsecutiveDeclarations: false
51AlignEscapedNewlines: Right
52AlignOperands: true
53AlignTrailingComments: true
54AllowAllArgumentsOnNextLine: true
55AllowAllParametersOfDeclarationOnNextLine: true
56AllowShortEnumsOnASingleLine: true
57AllowShortBlocksOnASingleLine: false
58AllowShortCaseLabelsOnASingleLine: false
59AllowShortFunctionsOnASingleLine: All
60AllowShortLambdasOnASingleLine: All
61AllowShortIfStatementsOnASingleLine: Never
62AllowShortLoopsOnASingleLine: false
63AlwaysBreakAfterDefinitionReturnType: All
64AlwaysBreakAfterReturnType: AllDefinitions
65AlwaysBreakBeforeMultilineStrings: false
66BinPackArguments: true
67BinPackParameters: true
68BraceWrapping:
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
85BreakBeforeBinaryOperators: All
86BreakBeforeBraces: GNU
87BreakBeforeInheritanceComma: false
88BreakInheritanceList: BeforeColon
89BreakBeforeTernaryOperators: true
90BreakStringLiterals: true
91ColumnLimit: 79
92CommentPragmas: '^ IWYU pragma:'
93CompactNamespaces: false
94ContinuationIndentWidth: 4
95Cpp11BracedListStyle: false
96DeriveLineEnding: true
97DerivePointerAlignment: false
98DisableFormat: false
99ExperimentalAutoDetectBinPacking: false
100FixNamespaceComments: false
101IncludeBlocks: Preserve
102IncludeCategories:
103 - Regex: '.*'
104 Priority: 1
105IncludeIsMainRegex: '(Test)?$'
106IndentCaseLabels: false
107IndentCaseBlocks: false
108IndentGotoLabels: true
109IndentWidth: 2
110IndentPPDirectives: AfterHash
111IndentExternBlock: AfterExternBlock
112IndentWrappedFunctionNames: false
113InsertTrailingCommas: None
114KeepEmptyLinesAtTheStartOfBlocks: true
115MacroBlockBegin: ''
116MacroBlockEnd: ''
117MaxEmptyLinesToKeep: 1
118NamespaceIndentation: None
119PenaltyBreakAssignment: 2
120PenaltyBreakBeforeFirstCallParameter: 19
121PenaltyBreakComment: 300
122PenaltyBreakFirstLessLess: 120
123PenaltyBreakString: 1000
124PenaltyExcessCharacter: 1000000
125PenaltyReturnTypeOnItsOwnLine: 60
126PointerAlignment: Right
127ReflowComments: true
128SortIncludes: false
129SortUsingDeclarations: true
130SpaceAfterCStyleCast: true
131SpaceAfterLogicalNot: false
132SpaceBeforeAssignmentOperators: true
133SpaceBeforeCpp11BracedList: false
134SpaceBeforeCtorInitializerColon: true
135SpaceBeforeInheritanceColon: true
136SpaceBeforeParens: Always
137SpaceBeforeRangeBasedForLoopColon: true
138SpaceInEmptyBlock: false
139SpaceInEmptyParentheses: false
140SpacesBeforeTrailingComments: 1
141SpacesInAngles: false
142SpacesInConditionalStatement: false
143SpacesInContainerLiterals: true
144SpacesInCStyleCastParentheses: false
145SpacesInParentheses: false
146SpacesInSquareBrackets: false
147SpaceBeforeSquareBrackets: false
148Standard: Cpp03
149TabWidth: 8
150UseTab: Always
151ForEachMacros:
152 - 'FOR_EACH_IMPL'
153 - 'list_for_each'
154 - 'list_for_each_prev'
155 - 'list_for_each_prev_safe'
156...