Re: [PATCH v1] checkpatch: Add context-analysis attributes
From: Joe Perches
Date: Sat Nov 14 2026 - 09:57:55 EST
On Sat, 2026-11-14 at 06:26 -0800, Joe Perches wrote:
> > How about matching one internal () pair?
> >
> > __guarded_by\s*\(
> > (?:
> > [^()]++ |
> > \([^()]*+\)
> > )*+
> > \)
>
> Sure.
> Please add and use another variable so it's not repeated everywhere.
Reading a bit about balanced parentheses in perl '(?R)'
non capturing recursion works since 5.10.0
Maybe instead use
/\((?:[^()]++|(?R))*\)/
and I should probably rework all of checkpatch's uses of
$balanced_parens to avoid all those weird capture group uses
as it was originally written for perl 5.8 (thanks akpm)