[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180410143950.4b8526073b4e3e34689f68cb@linux-foundation.org>
Date: Tue, 10 Apr 2018 14:39:50 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: Joe Perches <joe@...ches.com>
Cc: Peter Zijlstra <peterz@...radead.org>,
"Rafael J. Wysocki" <rafael@...nel.org>,
Andy Whitcroft <apw@...onical.com>, yuankuiz@...eaurora.org,
Linux PM <linux-pm@...r.kernel.org>,
"Rafael J. Wysocki" <rjw@...ysocki.net>,
Frederic Weisbecker <fweisbec@...il.com>,
Thomas Gleixner <tglx@...utronix.de>,
paulmck@...ux.vnet.ibm.com, Ingo Molnar <mingo@...nel.org>,
Len Brown <len.brown@...el.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] checkpatch: Add a --strict test for structs with bool
member definitions
On Tue, 10 Apr 2018 11:19:54 -0700 Joe Perches <joe@...ches.com> wrote:
> A struct with a bool member can have different sizes on various
> architectures because neither bool size nor alignment is standardized.
>
> So emit a message on the use of bool in structs only in .h files and
> not .c files.
>
> There is the real possibility that this test could have a false positive
> when a bool is declared as an automatic, so limit the test to .h files
> where the only false positive is for declarations in static inline functions.
What's wrong with bools in structs? The changelog should be
self-contained, please. At least add a link in the changelog (of the
lkml.kernel.org/r/MSGID variety), but a link in the changelog is risky
because the reader may be offline or the server may be down.
> --- a/scripts/checkpatch.pl
> +++ b/scripts/checkpatch.pl
> @@ -6257,6 +6257,13 @@ sub process {
> "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);
And... the server is down. Am unable to understand or review this patch!
> + }
> +
> # check for semaphores initialized locked
> if ($line =~ /^.\s*sema_init.+,\W?0\W?\)/) {
> WARN("CONSIDER_COMPLETION",
Powered by blists - more mailing lists