On Wed, 3 Jun 2026 at 21:55, Pierrick Bouvier
<[email protected]> wrote:
>
> C++ has a different style when it comes to space around references,
> dereferences, so don't report it.
> Also, closing templates with >> gets wrongly confused with >> operator,
> so just relax this check.
>
> Signed-off-by: Pierrick Bouvier <[email protected]>
> ---
>  scripts/checkpatch.pl | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
>
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> index 2189db19f54..c74ec070c53 100755
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -2621,6 +2621,23 @@ sub process {
>                                                 if ($op eq '::') {
>                                                         $ok = 1;
>                                                 }
> +
> +                                               # Ignore * in C++
> +                                               if ($op eq '*') {
> +                                                       $ok = 1;
> +                                               }
> +
> +                                               # Ignore & in C++

I think it would be helpful if these comments said why we're ignoring
the operators, the way we do for the one about ">>". Why we should
ignore "::" is clear (it's an operator that exists in C++ and not C),
but * and & are both present in C, so we should say why C++ is special.

> +                                               if ($op eq '&') {
> +                                                       $ok = 1;
> +                                               }
> +
> +                                               # Ignore >> in C++
> +                                               # checkpatch is confused by
> +                                               # >> closing templates
> +                                               if ($op eq '>>') {
> +                                                       $ok = 1;
> +                                               }
>                                         }

thanks
-- PMM

Reply via email to