* [PATCH] clang-format: Fix formatting of guard() and scoped_guard() statements
@ 2026-04-13 18:23 Bart Van Assche
2026-07-02 15:50 ` Mickaël Salaün
0 siblings, 1 reply; 2+ messages in thread
From: Bart Van Assche @ 2026-04-13 18:23 UTC (permalink / raw)
To: Miguel Ojeda
Cc: linux-kernel, Bart Van Assche, Peter Zijlstra, Ingo Molnar,
Andrew Morton, Nathan Chancellor
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 <peterz@infradead.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
.clang-format | 2 ++
1 file changed, 2 insertions(+)
diff --git a/.clang-format b/.clang-format
index 1cc151e2adcc..6a3de86ab27a 100644
--- a/.clang-format
+++ b/.clang-format
@@ -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'
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] clang-format: Fix formatting of guard() and scoped_guard() statements
2026-04-13 18:23 [PATCH] clang-format: Fix formatting of guard() and scoped_guard() statements Bart Van Assche
@ 2026-07-02 15:50 ` Mickaël Salaün
0 siblings, 0 replies; 2+ messages in thread
From: Mickaël Salaün @ 2026-07-02 15:50 UTC (permalink / raw)
To: Bart Van Assche
Cc: Miguel Ojeda, linux-kernel, Peter Zijlstra, Ingo Molnar,
Andrew Morton, Nathan Chancellor, Günther Noack
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
On Mon, Apr 13, 2026 at 11:23:48AM -0700, Bart Van Assche wrote:
> Without this patch clang-format formats guard() and scoped_guard()
> statements as follows:
>
> guard(...)(...)
This should be scoped_guard(...)(...)
> {
> ...
> }
>
> With this patch clang-format formats guard() and scoped_guard()
> statements as follows:
>
> guard(...)(...) {
> ...
> }
>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Ingo Molnar <mingo@kernel.org>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> ---
> .clang-format | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/.clang-format b/.clang-format
> index 1cc151e2adcc..6a3de86ab27a 100644
> --- a/.clang-format
> +++ b/.clang-format
> @@ -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'
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-07-02 15:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-13 18:23 [PATCH] clang-format: Fix formatting of guard() and scoped_guard() statements Bart Van Assche
2026-07-02 15:50 ` Mickaël Salaün
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox