Skip to contentSkip to conversation

clang-format: Fix formatting of guard() and scoped_guard() statements

PATCH Applied Bart Van Assche 2 participants 2 messages Apr 13 – Jul 2 Clang-format file

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 clang-format: Fix formatting of guard() and scoped_guard() statements

Without this patch clang-format formats guard() and scoped_guard() statements as follows:

	guard(...)(...)
	{
		...
	}

With this patch clang-format formats guard() and scoped_guard() statements as follows:

	guard(...)(...) {
		...
	}
Cc Peter Zijlstra <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Andrew Morton <[email protected]>
---
 .clang-format | 2 ++
 1 file changed, 2 insertions(+)
.clang-format +2 -0
index 1cc151e2adcc..6a3de86ab27a 100644
@@ -481,6 +481,7 @@ ForEachMacros:
   - 'genradix_for_each'
   - 'genradix_for_each_from'
   - 'genradix_for_each_reverse'
+  - 'guard'
   - 'hash_for_each'
   - 'hash_for_each_possible'
   - 'hash_for_each_possible_rcu'
@@ -674,6 +675,7 @@ ForEachMacros:
   - 'rq_list_for_each'
   - 'rq_list_for_each_safe'
   - 'sample_read_group__for_each'
+  - 'scoped_guard'
   - 'scsi_for_each_prot_sg'
   - 'scsi_for_each_sg'
   - 'sctp_for_each_hentry'
#1 lore raw

Hi,

I just noticed this patch with v7.2-rc1 . This looks good for scoped_guard()(){}, but not for guard(rcu)() (see security/landlock/*.[ch]):

- guard(rcu)();
+ guard(rcu)
+ ();

Should we revert the "guard" entry?

Mickaël

Quoted 4 lines · Bart Van Assche

Without this patch clang-format formats guard() and scoped_guard() statements as follows:

	guard(...)(...)

This should be scoped_guard(...)(...)

Quoted 39 lines
	{
		...
	}

With this patch clang-format formats guard() and scoped_guard() statements as follows:

	guard(...)(...) {
		...
	}
Cc Peter Zijlstra <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Andrew Morton <[email protected]>
---
 .clang-format | 2 ++
 1 file changed, 2 insertions(+)
.clang-format +2 -0
index 1cc151e2adcc..6a3de86ab27a 100644
@@ -481,6 +481,7 @@ ForEachMacros:
   - 'genradix_for_each'
   - 'genradix_for_each_from'
   - 'genradix_for_each_reverse'
+  - 'guard'
   - 'hash_for_each'
   - 'hash_for_each_possible'
   - 'hash_for_each_possible_rcu'
@@ -674,6 +675,7 @@ ForEachMacros:
   - 'rq_list_for_each'
   - 'rq_list_for_each_safe'
   - 'sample_read_group__for_each'
+  - 'scoped_guard'
   - 'scsi_for_each_prot_sg'
   - 'scsi_for_each_sg'
   - 'sctp_for_each_hentry'