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

From: Przemek Kitszel
Date: Mon Nov 27 2023 - 13:45:50 EST


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.

Signed-off-by: Przemek Kitszel <przemyslaw.kitszel@xxxxxxxxx>
---
scripts/checkpatch.pl | 2 ++
1 file changed, 2 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 7d16f863edf1..7f01bc8be2de 100755
--- 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/ &&
#Ignore some autogenerated defines and enum values
$var !~ /^(?:[A-Z]+_){1,5}[A-Z]{1,3}[a-z]/ &&
#Ignore Page<foo> variants
--
2.38.1