diff options
author | Joe Perches <joe@perches.com> | 2020-12-16 07:44:30 +0300 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2020-12-16 09:46:17 +0300 |
commit | 73169765e6e7ac54528778faa592b15df5c8a93c (patch) | |
tree | fb19e7a4ea734e5f0a081c146bae944c41ecda58 /scripts/Makefile.gcc-plugins | |
parent | 4104a20646fe20ed5aa9be883eef7340b219f9a8 (diff) | |
download | linux-73169765e6e7ac54528778faa592b15df5c8a93c.tar.xz |
checkpatch: prefer static const declarations
There are about 100,000 uses of 'static const <type>' but about 400 uses
of 'static <type> const' in the kernel where type is not a pointer.
The kernel almost always uses "static const" over "const static" as there
is a compiler warning for that declaration style.
But there is no compiler warning for "static <type> const".
So add a checkpatch warning for the atypical declaration uses of.
const static <type> <foo>
and
static <type> const <foo>
For example:
$ ./scripts/checkpatch.pl -f --emacs --quiet --nosummary -types=static_const arch/arm/crypto/aes-ce-glue.c
arch/arm/crypto/aes-ce-glue.c:75: WARNING: Move const after static - use 'static const u8'
#75: FILE: arch/arm/crypto/aes-ce-glue.c:75:
+ static u8 const rcon[] = {
Link: https://lkml.kernel.org/r/4b863be68e679546b40d50b97a4a806c03056a1c.camel@perches.com
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'scripts/Makefile.gcc-plugins')
0 files changed, 0 insertions, 0 deletions