Re: [PATCH] checkpatch: don't complain on _Static_assert and _Generic use

From: Joe Perches
Date: Tue Nov 28 2023 - 05:52:10 EST


On Tue, 2023-11-28 at 11:25 +0100, Przemek Kitszel wrote:
> On 11/28/23 01:46, Joe Perches wrote:
> > On Mon, 2023-11-27 at 16:18 +0100, Przemek Kitszel wrote:
> > > Improve CamelCase recognition logic to avoid reporting on _Static_assert()
> > > and _Generic() use.
> > >
> > > Other C keywords, such as _Bool, are intentionally omitted, as those
> > > should be rather avoided in new source code.
> > []
> > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> > []
> > > @@ -5839,6 +5839,8 @@ sub process {
> > > #CamelCase
> > > if ($var !~ /^$Constant$/ &&
> > > $var =~ /[A-Z][a-z]|[a-z][A-Z]/ &&
> > > +#Ignore C keywords
> > > + $var !~ /_Static_assert|_Generic/ &&
> >
> > You'll need
> >
> > $var != /^(?:_Static_assert|_Generic)$/ &&
> >
> > to avoid words that contain either
>
> you are correct, thanks
>
> also good to use non-capturing group :), for

Well mostly correct minus the mindless typing of != instead of !~