2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-09-03 08:05:21 +00:00

[9.20] 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) {`.

Backport of MR !10863

Merge branch 'backport-ondrej/update-clang-format-9.20' into 'bind-9.20'

See merge request isc-projects/bind9!10864
This commit is contained in:
Ondřej Surý
2025-08-19 09:06:14 +02:00
9 changed files with 28 additions and 18 deletions

View File

@@ -69,6 +69,7 @@ IncludeCategories:
- Regex: '.*'
Priority: 0
IndentExternBlock: NoIndent
InsertBraces: true
KeepEmptyLinesAtTheStartOfBlocks: false
MaxEmptyLinesToKeep: 1
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' ]
RemoveParentheses: ReturnStatement
RemoveSemicolon: true
SpaceBeforeParens: ControlStatementsExceptControlMacros

View File

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

View File

@@ -1550,3 +1550,7 @@ c22176c0f9a71217be9bfab00573f8f0265499af
58a15d38c2c321fac75abef389a48ff82deaccf0
# Reformat sources with up-to-date clang-format-20
53738b0e5e0037b7ac8d06e146832d972e2e46d5
# Add and apply InsertBraces statement
58791b5cfe8d6d17e05a450fb9cf72cc52472541
# Use ControlStatementsExceptControlMacros for SpaceBeforeParens
8f8fb10232eabcee1d78efb52623a07d6326cdb6

View File

@@ -462,8 +462,7 @@ static void
dns__acl_destroy_port_transports(dns_acl_t *acl) {
dns_acl_port_transports_t *port_proto = NULL;
dns_acl_port_transports_t *next = NULL;
ISC_LIST_FOREACH_SAFE (acl->ports_and_transports, port_proto, link,
next)
ISC_LIST_FOREACH_SAFE(acl->ports_and_transports, port_proto, link, next)
{
ISC_LIST_DEQUEUE(acl->ports_and_transports, port_proto, link);
isc_mem_put(acl->mctx, port_proto, sizeof(*port_proto));

View File

@@ -485,8 +485,7 @@ msgresetnames(dns_message_t *msg, unsigned int first_section) {
for (size_t i = first_section; i < DNS_SECTION_MAX; i++) {
dns_name_t *name = NULL, *next_name = NULL;
ISC_LIST_FOREACH_SAFE (msg->sections[i], name, link, next_name)
{
ISC_LIST_FOREACH_SAFE(msg->sections[i], name, link, next_name) {
ISC_LIST_UNLINK(msg->sections[i], name, link);
msgresetname(msg, name);

View File

@@ -87,9 +87,10 @@ sched_affinity_ncpus(void) {
int i, n = 0;
for (i = 0; i < CPU_SETSIZE; ++i) {
if (CPU_ISSET(i, &cpus))
if (CPU_ISSET(i, &cpus)) {
++n;
}
}
return n;
#endif
}
@@ -115,9 +116,10 @@ cpuset_affinity_ncpus(void) {
if (result != -1) {
int i, n = 0;
for (i = 0; i < CPU_SETSIZE; ++i) {
if (CPU_ISSET(i, &cpus))
if (CPU_ISSET(i, &cpus)) {
++n;
}
}
return n;
}
return 0;

View File

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