Re: [PATCH v3] coding-style: Clarify the expectations around bool

From
Joe Perches <joe@perches.com>
Date
2019-01-08 00:39:03
Also in
linux-rdma, lkml
Reply to
Jason Gunthorpe, 2019-01-07
On Mon, 2019-01-07 at 16:25 -0700, Jason Gunthorpe wrote:
On Mon, Jan 07, 2019 at 02:10:22PM -0800, Joe Perches wrote:
quoted
On Mon, 2019-01-07 at 14:11 -0700, Jason Gunthorpe wrote:
quoted
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.
Thanks Jason.

It'd be nice to combine this with some better checkpatch warning or
even a removal of that misleading warning from checkpatch
altogether.
Okay, do you have a preference?
Yes.
---
 scripts/checkpatch.pl | 13 -------------
 1 file changed, 13 deletions(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 155fa9305166..cfe0396c9845 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -6370,19 +6370,6 @@ sub process {
 			}
 		}
 
-# check for bool bitfields
-		if ($sline =~ /^.\s+bool\s*$Ident\s*:\s*\d+\s*;/) {
-			WARN("BOOL_BITFIELD",
-			     "Avoid using bool as bitfield.  Prefer bool bitfields as unsigned int or u<8|16|32>\n" . $herecurr);
-		}
-
-# check for bool use in .h files
-		if ($realfile =~ /\.h$/ &&
-		    $sline =~ /^.\s+bool\s*$Ident\s*(?::\s*d+\s*)?;/) {
-			CHK("BOOL_MEMBER",
-			    "Avoid using bool structure members because of possible alignment issues - see: https://lkml.org/lkml/2017/11/21/384\n" . $herecurr);
-		}
-
 # check for semaphores initialized locked
 		if ($line =~ /^.\s*sema_init.+,\W?0\W?\)/) {
 			WARN("CONSIDER_COMPLETION",
Thread (6 messages) 6 messages, 3 authors, last reply 2019-01-08
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help