2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-29 13:38:26 +00:00

chg: dev: Update clang-format style with options added in newer versions

Add and apply InsertBraces statement to add missing curly braces around one-line statements and use ControlStatementsExceptControlMacros for SpaceBeforeParens to remove space between foreach macro and the brace, e.g. `FOREACH (x) {` becomes `FOREACH(x) {`.

Merge branch 'ondrej/update-clang-format' into 'main'

See merge request isc-projects/bind9!10863
This commit is contained in:
Ondřej Surý 2025-08-19 08:00:20 +02:00
commit 0da10d8bbe
105 changed files with 918 additions and 908 deletions

View File

@ -69,6 +69,7 @@ IncludeCategories:
- Regex: '.*' - Regex: '.*'
Priority: 0 Priority: 0
IndentExternBlock: NoIndent IndentExternBlock: NoIndent
InsertBraces: true
KeepEmptyLinesAtTheStartOfBlocks: false KeepEmptyLinesAtTheStartOfBlocks: false
MaxEmptyLinesToKeep: 1 MaxEmptyLinesToKeep: 1
PenaltyBreakAssignment: 30 PenaltyBreakAssignment: 30
@ -81,3 +82,4 @@ ContinuationIndentWidth: 8
ForEachMacros: [ 'cds_lfs_for_each', 'cds_lfs_for_each_safe', 'cds_list_for_each_entry_safe', 'ISC_LIST_FOREACH', 'ISC_LIST_FOREACH_SAFE', 'ISC_LIST_FOREACH_REV', 'ISC_LIST_FOREACH_REV_SAFE', 'MSG_SECTION_FOREACH', 'DNS_DBITERATOR_FOREACH', 'DNS_RDATASET_FOREACH', 'DNS_RDATASETITER_FOREACH', 'CFG_LIST_FOREACH' ] ForEachMacros: [ 'cds_lfs_for_each', 'cds_lfs_for_each_safe', 'cds_list_for_each_entry_safe', 'ISC_LIST_FOREACH', 'ISC_LIST_FOREACH_SAFE', 'ISC_LIST_FOREACH_REV', 'ISC_LIST_FOREACH_REV_SAFE', 'MSG_SECTION_FOREACH', 'DNS_DBITERATOR_FOREACH', 'DNS_RDATASET_FOREACH', 'DNS_RDATASETITER_FOREACH', 'CFG_LIST_FOREACH' ]
RemoveParentheses: ReturnStatement RemoveParentheses: ReturnStatement
RemoveSemicolon: true RemoveSemicolon: true
SpaceBeforeParens: ControlStatementsExceptControlMacros

View File

@ -69,6 +69,7 @@ IncludeCategories:
- Regex: '.*' - Regex: '.*'
Priority: 0 Priority: 0
IndentExternBlock: NoIndent IndentExternBlock: NoIndent
InsertBraces: true
KeepEmptyLinesAtTheStartOfBlocks: false KeepEmptyLinesAtTheStartOfBlocks: false
MaxEmptyLinesToKeep: 1 MaxEmptyLinesToKeep: 1
PenaltyBreakAssignment: 30 PenaltyBreakAssignment: 30
@ -80,3 +81,4 @@ Standard: Cpp11
ContinuationIndentWidth: 8 ContinuationIndentWidth: 8
RemoveParentheses: ReturnStatement RemoveParentheses: ReturnStatement
RemoveSemicolon: true RemoveSemicolon: true
SpaceBeforeParens: ControlStatementsExceptControlMacros

View File

@ -1550,3 +1550,7 @@ ebb5bd9c0f079de8970b538fe48e5f5c60ea7ee9
0258850f202b7a46b52f3e3a4968c3fc68fe9a45 0258850f202b7a46b52f3e3a4968c3fc68fe9a45
# Reformat sources with up-to-date clang-format-20 # Reformat sources with up-to-date clang-format-20
422b9118e878d3106c84b2eac44371f7143f320b 422b9118e878d3106c84b2eac44371f7143f320b
# Add and apply InsertBraces statement
d051e1e8f8eea1400191e0fd20641394b7d438be
# Use ControlStatementsExceptControlMacros for SpaceBeforeParens
42496f3f4a8802c0ba8033a1bcabc8bebf5b0087

View File

@ -752,8 +752,10 @@ Exit:
if (decoder->_total_overhead >= 100 * 1024 && if (decoder->_total_overhead >= 100 * 1024 &&
decoder->_total_read - decoder->_total_overhead < decoder->_total_read - decoder->_total_overhead <
decoder->_total_read / 4) decoder->_total_read / 4)
{
ret = -1; ret = -1;
} }
}
return ret; return ret;
} }