The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: "Mickaël Salaün" <mic@digikod.net>
To: Bart Van Assche <bvanassche@acm.org>
Cc: "Miguel Ojeda" <ojeda@kernel.org>,
	linux-kernel@vger.kernel.org,
	"Peter Zijlstra" <peterz@infradead.org>,
	"Ingo Molnar" <mingo@kernel.org>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"Nathan Chancellor" <nathan@kernel.org>,
	"Günther Noack" <gnoack3000@gmail.com>
Subject: Re: [PATCH] clang-format: Fix formatting of guard() and scoped_guard() statements
Date: Thu, 2 Jul 2026 17:50:51 +0200	[thread overview]
Message-ID: <20260702.Eibibi4the9j@digikod.net> (raw)
In-Reply-To: <20260413182348.1865138-1-bvanassche@acm.org>

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'

      reply	other threads:[~2026-07-02 15:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260702.Eibibi4the9j@digikod.net \
    --to=mic@digikod.net \
    --cc=akpm@linux-foundation.org \
    --cc=bvanassche@acm.org \
    --cc=gnoack3000@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=nathan@kernel.org \
    --cc=ojeda@kernel.org \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox