aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/checkpatch.pl
diff options
context:
space:
mode:
authorJason Gunthorpe <jgg@ziepe.ca>2019-01-18 17:50:47 -0500
committerJonathan Corbet <corbet@lwn.net>2019-01-20 21:07:39 -0500
commit7967656ffbfa493f5546c0f18bf8a28f702c4baa (patch)
tree64fc3eaa5ae81d1778891bc47c15a226ba2430df /scripts/checkpatch.pl
parentb04c11c988f4fcfba037ce6c356ea5ac9e23df63 (diff)
coding-style: Clarify the expectations around bool
There has been some confusion since checkpatch started warning about bool use in structures, and people have been avoiding using it. Many people feel there is still a legitimate place for bool in structures, so provide some guidance on bool usage derived from the entire thread that spawned the checkpatch warning. Link: https://lkml.kernel.org/r/CA+55aFwVZk1OfB9T2v014PTAKFhtVan_Zj2dOjnCy3x6E4UJfA@mail.gmail.com Signed-off-by: Joe Perches <joe@perches.com> Acked-by: Joe Perches <joe@perches.com> Reviewed-by: Bart Van Assche <bvanassche@acm.org> Acked-by: Jani Nikula <jani.nikula@intel.com> Reviewed-by: Joey Pabalinas <joeypabalinas@gmail.com> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com> Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Diffstat (limited to 'scripts/checkpatch.pl')
-rwxr-xr-xscripts/checkpatch.pl13
1 files changed, 0 insertions, 13 deletions
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index b737ca9d7204..d62abd032885 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -6368,19 +6368,6 @@ sub process {
6368 } 6368 }
6369 } 6369 }
6370 6370
6371# check for bool bitfields
6372 if ($sline =~ /^.\s+bool\s*$Ident\s*:\s*\d+\s*;/) {
6373 WARN("BOOL_BITFIELD",
6374 "Avoid using bool as bitfield. Prefer bool bitfields as unsigned int or u<8|16|32>\n" . $herecurr);
6375 }
6376
6377# check for bool use in .h files
6378 if ($realfile =~ /\.h$/ &&
6379 $sline =~ /^.\s+bool\s*$Ident\s*(?::\s*d+\s*)?;/) {
6380 CHK("BOOL_MEMBER",
6381 "Avoid using bool structure members because of possible alignment issues - see: https://lkml.org/lkml/2017/11/21/384\n" . $herecurr);
6382 }
6383
6384# check for semaphores initialized locked 6371# check for semaphores initialized locked
6385 if ($line =~ /^.\s*sema_init.+,\W?0\W?\)/) { 6372 if ($line =~ /^.\s*sema_init.+,\W?0\W?\)/) {
6386 WARN("CONSIDER_COMPLETION", 6373 WARN("CONSIDER_COMPLETION",