Using bool in a bitfield isn't a good idea as the alignment behavior is arch implementation defined. Suggest using unsigned int or u<8|16|32> instead.
Showing the changes to scripts/checkpatch.pl (1 of 1 file). Show all
Unified · Split
| @@ -6251,6 +6251,12 @@ sub process { · 6250 unmodified lines | ||
| 6251 | 6251 | } |
| 6252 | 6252 | } |
| 6253 | 6253 | |
| 6254 | +# check for bool bitfields | |
| 6255 | + if ($sline =~ /^.\s+bool\s*$Ident\s*:\s*\d+\s*;/) { | |
| 6256 | + WARN("BOOL_BITFIELD", | |
| 6257 | + "Avoid using bool as bitfield. Prefer bool bitfields as unsigned int or u<8|16|32>\n" . $herecurr); | |
| 6258 | + } | |
| 6259 | + | |
| 6254 | 6260 | # check for semaphores initialized locked |
| 6255 | 6261 | if ($line =~ /^.\s*sema_init.+,\W?0\W?\)/) { |
| 6256 | 6262 | WARN("CONSIDER_COMPLETION", |