Skip to content

Commit 30ac9bf

Browse files
authored
Bump clang-format from 17.0.6 to 20.1.0 (#2046)
* Upgrade Python package dependencies * Format all source files * Update clang-format config options
1 parent 777168b commit 30ac9bf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+193
-192
lines changed

.clang-format

Lines changed: 58 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
---
22
Language: Cpp
3-
# BasedOnStyle: LLVM
43
AccessModifierOffset: -2
54
AlignAfterOpenBracket: Align
65
AlignArrayOfStructures: None
@@ -9,48 +8,83 @@ AlignConsecutiveAssignments:
98
AcrossEmptyLines: false
109
AcrossComments: false
1110
AlignCompound: false
11+
AlignFunctionDeclarations: false
12+
AlignFunctionPointers: false
1213
PadOperators: true
1314
AlignConsecutiveBitFields:
1415
Enabled: false
1516
AcrossEmptyLines: false
1617
AcrossComments: false
1718
AlignCompound: false
19+
AlignFunctionDeclarations: false
20+
AlignFunctionPointers: false
1821
PadOperators: false
1922
AlignConsecutiveDeclarations:
2023
Enabled: false
2124
AcrossEmptyLines: false
2225
AcrossComments: false
2326
AlignCompound: false
27+
AlignFunctionDeclarations: true
28+
AlignFunctionPointers: false
2429
PadOperators: false
2530
AlignConsecutiveMacros:
2631
Enabled: false
2732
AcrossEmptyLines: false
2833
AcrossComments: false
2934
AlignCompound: false
35+
AlignFunctionDeclarations: false
36+
AlignFunctionPointers: false
3037
PadOperators: false
3138
AlignConsecutiveShortCaseStatements:
3239
Enabled: false
3340
AcrossEmptyLines: false
3441
AcrossComments: false
42+
AlignCaseArrows: false
3543
AlignCaseColons: false
44+
AlignConsecutiveTableGenBreakingDAGArgColons:
45+
Enabled: false
46+
AcrossEmptyLines: false
47+
AcrossComments: false
48+
AlignCompound: false
49+
AlignFunctionDeclarations: false
50+
AlignFunctionPointers: false
51+
PadOperators: false
52+
AlignConsecutiveTableGenCondOperatorColons:
53+
Enabled: false
54+
AcrossEmptyLines: false
55+
AcrossComments: false
56+
AlignCompound: false
57+
AlignFunctionDeclarations: false
58+
AlignFunctionPointers: false
59+
PadOperators: false
60+
AlignConsecutiveTableGenDefinitionColons:
61+
Enabled: false
62+
AcrossEmptyLines: false
63+
AcrossComments: false
64+
AlignCompound: false
65+
AlignFunctionDeclarations: false
66+
AlignFunctionPointers: false
67+
PadOperators: false
3668
AlignEscapedNewlines: Left
3769
AlignOperands: Align
3870
AlignTrailingComments:
3971
Kind: Always
4072
OverEmptyLines: 0
4173
AllowAllArgumentsOnNextLine: true
4274
AllowAllParametersOfDeclarationOnNextLine: true
75+
AllowBreakBeforeNoexceptSpecifier: Never
4376
AllowShortBlocksOnASingleLine: Never
77+
AllowShortCaseExpressionOnASingleLine: true
4478
AllowShortCaseLabelsOnASingleLine: false
79+
AllowShortCompoundRequirementOnASingleLine: true
4580
AllowShortEnumsOnASingleLine: true
4681
AllowShortFunctionsOnASingleLine: None
4782
AllowShortIfStatementsOnASingleLine: Never
4883
AllowShortLambdasOnASingleLine: All
4984
AllowShortLoopsOnASingleLine: false
85+
AllowShortNamespacesOnASingleLine: false
5086
AlwaysBreakAfterDefinitionReturnType: None
51-
AlwaysBreakAfterReturnType: All
5287
AlwaysBreakBeforeMultilineStrings: false
53-
AlwaysBreakTemplateDeclarations: MultiLine
5488
AttributeMacros:
5589
- __capability
5690
- BSON_GNUC_WARN_UNUSED_RESULT
@@ -78,17 +112,22 @@ BraceWrapping:
78112
SplitEmptyFunction: true
79113
SplitEmptyRecord: true
80114
SplitEmptyNamespace: true
115+
BreakAdjacentStringLiterals: true
81116
BreakAfterAttributes: Never
82117
BreakAfterJavaFieldAnnotations: false
118+
BreakAfterReturnType: All
83119
BreakArrays: true
84120
BreakBeforeBinaryOperators: None
85121
BreakBeforeConceptDeclarations: Always
86122
BreakBeforeBraces: Linux
87123
BreakBeforeInlineASMColon: OnlyMultiline
88124
BreakBeforeTernaryOperators: true
125+
BreakBinaryOperations: Never
89126
BreakConstructorInitializers: BeforeColon
127+
BreakFunctionDefinitionParameters: false
90128
BreakInheritanceList: BeforeColon
91129
BreakStringLiterals: true
130+
BreakTemplateDeclarations: MultiLine
92131
ColumnLimit: 120
93132
CommentPragmas: '^ IWYU pragma:'
94133
CompactNamespaces: false
@@ -131,6 +170,7 @@ IncludeIsMainSourceRegex: ''
131170
IndentAccessModifiers: false
132171
IndentCaseBlocks: false
133172
IndentCaseLabels: false
173+
IndentExportBlock: true
134174
IndentExternBlock: AfterExternBlock
135175
IndentGotoLabels: true
136176
IndentPPDirectives: None
@@ -149,12 +189,16 @@ IntegerLiteralSeparator:
149189
HexMinDigits: 0
150190
JavaScriptQuotes: Leave
151191
JavaScriptWrapImports: true
152-
KeepEmptyLinesAtTheStartOfBlocks: false
153-
KeepEmptyLinesAtEOF: false
192+
KeepEmptyLines:
193+
AtEndOfFile: false
194+
AtStartOfBlock: false
195+
AtStartOfFile: false
196+
KeepFormFeed: false
154197
LambdaBodyIndentation: Signature
155198
LineEnding: DeriveLF
156199
MacroBlockBegin: ''
157200
MacroBlockEnd: ''
201+
MainIncludeChar: AngleBracket
158202
MaxEmptyLinesToKeep: 2
159203
NamespaceIndentation: None
160204
ObjCBinPackProtocolList: Auto
@@ -165,9 +209,11 @@ ObjCSpaceBeforeProtocolList: true
165209
PackConstructorInitializers: BinPack
166210
PenaltyBreakAssignment: 2
167211
PenaltyBreakBeforeFirstCallParameter: 19
212+
PenaltyBreakBeforeMemberAccess: 150
168213
PenaltyBreakComment: 300
169214
PenaltyBreakFirstLessLess: 120
170215
PenaltyBreakOpenParenthesis: 0
216+
PenaltyBreakScopeResolution: 500
171217
PenaltyBreakString: 1000
172218
PenaltyBreakTemplateDeclaration: 10
173219
PenaltyExcessCharacter: 1000000
@@ -177,14 +223,16 @@ PointerAlignment: Right
177223
PPIndentWidth: -1
178224
QualifierAlignment: Leave
179225
ReferenceAlignment: Pointer
180-
ReflowComments: true
226+
ReflowComments: Always
181227
RemoveBracesLLVM: false
228+
RemoveEmptyLinesInUnwrappedLines: false
182229
RemoveParentheses: Leave
183230
RemoveSemicolon: false
184231
RequiresClausePosition: OwnLine
185232
RequiresExpressionIndentation: OuterScope
186233
SeparateDefinitionBlocks: Leave
187234
ShortNamespaceLines: 1
235+
SkipMacroDefinitionBody: false
188236
SortIncludes: Never
189237
SortJavaStaticImport: Before
190238
SortUsingDeclarations: LexicographicNumeric
@@ -206,6 +254,7 @@ SpaceBeforeParensOptions:
206254
AfterFunctionDeclarationName: false
207255
AfterIfMacros: true
208256
AfterOverloadedOperator: false
257+
AfterPlacementOperator: false
209258
AfterRequiresInClause: false
210259
AfterRequiresInExpression: false
211260
BeforeNonEmptyParentheses: false
@@ -220,6 +269,7 @@ SpacesInLineCommentPrefix:
220269
Maximum: -1
221270
SpacesInParens: Never
222271
SpacesInParensOptions:
272+
ExceptDoubleParentheses: false
223273
InCStyleCasts: false
224274
InConditionalStatements: false
225275
InEmptyParentheses: false
@@ -231,6 +281,7 @@ StatementAttributeLikeMacros:
231281
StatementMacros:
232282
- Q_UNUSED
233283
- QT_REQUIRE_VERSION
284+
TableGenBreakInsideDAGArg: DontBreak
234285
TabWidth: 3
235286
UseTab: Never
236287
VerilogBreakBetweenInstancePorts: true
@@ -240,4 +291,5 @@ WhitespaceSensitiveMacros:
240291
- NS_SWIFT_NAME
241292
- PP_STRINGIZE
242293
- STRINGIZE
294+
WrapNamespaceBodyWithEmptyLines: Leave
243295
...

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ dev = [
1818

1919
format = [
2020
# .evergreen/scripts/clang-format-all.sh
21-
"clang-format~=17.0.6",
21+
"clang-format~=20.1.0",
2222
]
2323

2424
docs = [

src/libbson/src/bson/bson-decimal128.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
/*
32
* Copyright 2009-present MongoDB, Inc.
43
*

src/libbson/src/bson/bson-iter.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ bson_iter_init (bson_iter_t *iter, /* OUT */
6464
iter->d4 = 0;
6565
iter->next_off = 4;
6666
iter->err_off = 0;
67-
iter->value = (bson_value_t){0};
67+
iter->value = (bson_value_t) {0};
6868

6969
return true;
7070
}

src/libbson/src/bson/bson-json.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ bson_json_opts_new (bson_json_mode_t mode, int32_t max_len)
396396
bson_json_opts_t *opts;
397397

398398
opts = (bson_json_opts_t *) bson_malloc (sizeof *opts);
399-
*opts = (bson_json_opts_t){
399+
*opts = (bson_json_opts_t) {
400400
.mode = mode,
401401
.max_len = max_len,
402402
.is_outermost_array = false,

src/libbson/src/bson/bson-types.h

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -136,13 +136,7 @@ BSON_ALIGNED_BEGIN (BSON_ALIGN_OF_PTR) typedef struct _bson_t {
136136
* bson_t b = BSON_INITIALIZER;
137137
* ]|
138138
*/
139-
#define BSON_INITIALIZER \
140-
{ \
141-
3, 5, \
142-
{ \
143-
5 \
144-
} \
145-
}
139+
#define BSON_INITIALIZER {3, 5, {5}}
146140

147141

148142
BSON_STATIC_ASSERT2 (bson_t, sizeof (bson_t) == 128);

src/libbson/src/bson/bson-vector.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ bson_vector_int8_view_init (bson_vector_int8_view_t *view_out, uint8_t *binary_d
8383
if (bson_vector_binary_header_impl_init (&header, binary_data, binary_data_len) &&
8484
bson_vector_int8_validate (header)) {
8585
if (view_out) {
86-
*view_out = (bson_vector_int8_view_t){
86+
*view_out = (bson_vector_int8_view_t) {
8787
.binary.data = binary_data, .binary.data_len = binary_data_len, .binary.header_copy = header};
8888
}
8989
return true;
@@ -103,7 +103,7 @@ bson_vector_int8_const_view_init (bson_vector_int8_const_view_t *view_out,
103103
if (bson_vector_binary_header_impl_init (&header, binary_data, binary_data_len) &&
104104
bson_vector_int8_validate (header)) {
105105
if (view_out) {
106-
*view_out = (bson_vector_int8_const_view_t){
106+
*view_out = (bson_vector_int8_const_view_t) {
107107
.binary.data = binary_data, .binary.data_len = binary_data_len, .binary.header_copy = header};
108108
}
109109
return true;
@@ -121,7 +121,7 @@ bson_vector_float32_view_init (bson_vector_float32_view_t *view_out, uint8_t *bi
121121
if (bson_vector_binary_header_impl_init (&header, binary_data, binary_data_len) &&
122122
bson_vector_float32_validate (header, binary_data_len)) {
123123
if (view_out) {
124-
*view_out = (bson_vector_float32_view_t){
124+
*view_out = (bson_vector_float32_view_t) {
125125
.binary.data = binary_data, .binary.data_len = binary_data_len, .binary.header_copy = header};
126126
}
127127
return true;
@@ -141,7 +141,7 @@ bson_vector_float32_const_view_init (bson_vector_float32_const_view_t *view_out,
141141
if (bson_vector_binary_header_impl_init (&header, binary_data, binary_data_len) &&
142142
bson_vector_float32_validate (header, binary_data_len)) {
143143
if (view_out) {
144-
*view_out = (bson_vector_float32_const_view_t){
144+
*view_out = (bson_vector_float32_const_view_t) {
145145
.binary.data = binary_data, .binary.data_len = binary_data_len, .binary.header_copy = header};
146146
}
147147
return true;
@@ -161,7 +161,7 @@ bson_vector_packed_bit_view_init (bson_vector_packed_bit_view_t *view_out,
161161
if (bson_vector_binary_header_impl_init (&header, binary_data, binary_data_len) &&
162162
bson_vector_packed_bit_validate (header, binary_data, binary_data_len)) {
163163
if (view_out) {
164-
*view_out = (bson_vector_packed_bit_view_t){
164+
*view_out = (bson_vector_packed_bit_view_t) {
165165
.binary.data = binary_data, .binary.data_len = binary_data_len, .binary.header_copy = header};
166166
}
167167
return true;
@@ -181,7 +181,7 @@ bson_vector_packed_bit_const_view_init (bson_vector_packed_bit_const_view_t *vie
181181
if (bson_vector_binary_header_impl_init (&header, binary_data, binary_data_len) &&
182182
bson_vector_packed_bit_validate (header, binary_data, binary_data_len)) {
183183
if (view_out) {
184-
*view_out = (bson_vector_packed_bit_const_view_t){
184+
*view_out = (bson_vector_packed_bit_const_view_t) {
185185
.binary.data = binary_data, .binary.data_len = binary_data_len, .binary.header_copy = header};
186186
}
187187
return true;
@@ -306,7 +306,7 @@ bson_append_vector_int8_uninit (
306306
.bytes[1] = bson_vector_header_byte_1 (0)};
307307
memcpy (binary, header.bytes, BSON_VECTOR_HEADER_LEN);
308308
*view_out =
309-
(bson_vector_int8_view_t){.binary.data = binary, .binary.data_len = length, .binary.header_copy = header};
309+
(bson_vector_int8_view_t) {.binary.data = binary, .binary.data_len = length, .binary.header_copy = header};
310310
return true;
311311
} else {
312312
return false;
@@ -331,7 +331,7 @@ bson_append_vector_float32_uninit (
331331
.bytes[1] = bson_vector_header_byte_1 (0)};
332332
memcpy (binary, header.bytes, BSON_VECTOR_HEADER_LEN);
333333
*view_out =
334-
(bson_vector_float32_view_t){.binary.data = binary, .binary.data_len = length, .binary.header_copy = header};
334+
(bson_vector_float32_view_t) {.binary.data = binary, .binary.data_len = length, .binary.header_copy = header};
335335
return true;
336336
} else {
337337
return false;
@@ -365,7 +365,7 @@ bson_append_vector_packed_bit_uninit (
365365
// No reason to read-modify-write here, it's better to write the whole byte.
366366
binary[length - 1u] = 0u;
367367
}
368-
*view_out = (bson_vector_packed_bit_view_t){
368+
*view_out = (bson_vector_packed_bit_view_t) {
369369
.binary.data = binary, .binary.data_len = length, .binary.header_copy = header};
370370
return true;
371371
} else {

src/libbson/src/bson/bson.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ BSON_STATIC_ASSERT2 (max_alloc_grow_fits_min_sizet, (uint64_t) BSON_MAX_SIZE * 2
299299
mlib_diagnostic_pop (); \
300300
goto append_failure; \
301301
} else if ((_length) > 0) { \
302-
*(_list).current++ = (_bson_append_bytes_arg){ \
302+
*(_list).current++ = (_bson_append_bytes_arg) { \
303303
.bytes = (const uint8_t *) (_bytes), \
304304
.length = (_length), \
305305
}; \

src/libbson/src/bson/validate.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ _bson_validate_impl_v2 (const bson_t *bson, bson_validate_flags_t flags, size_t
544544
BSON_ASSERT_PARAM (error);
545545

546546
// Clear the error
547-
*error = (bson_error_t){0};
547+
*error = (bson_error_t) {0};
548548

549549
// Initialize validation parameters
550550
validation_params const params = {

src/libmongoc/examples/find_and_modify_with_opts/fam.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
#include <mongoc/mongoc.h>
32

43
/* EXAMPLE_FAM_BYPASS_BEGIN */

0 commit comments

Comments
 (0)