forked from Mirror/frr
doc, tools: Remove ARRAY_SIZE check
checkpatch.pl wants you to use ARRAY_SIZE in a kernel header file. We don't have access to this kernel header file for normal compilation. I'm just going to remove it. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
This commit is contained in:
parent
c256a9a40a
commit
852a74807f
|
@ -761,15 +761,6 @@ Indentation and Line Breaks
|
|||
Macros, Attributes and Symbols
|
||||
------------------------------
|
||||
|
||||
**ARRAY_SIZE**
|
||||
The ARRAY_SIZE(foo) macro should be preferred over
|
||||
sizeof(foo)/sizeof(foo[0]) for finding number of elements in an
|
||||
array.
|
||||
|
||||
The macro is defined in include/linux/kernel.h::
|
||||
|
||||
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
|
||||
|
||||
**AVOID_EXTERNS**
|
||||
Function prototypes don't need to be declared extern in .h
|
||||
files. It's assumed by the compiler and is unnecessary.
|
||||
|
|
|
@ -4656,19 +4656,6 @@ sub process {
|
|||
$herecurr);
|
||||
}
|
||||
|
||||
# check for sizeof(foo)/sizeof(foo[0]) that could be ARRAY_SIZE(foo)
|
||||
if ($line =~ m@\bsizeof\s*\(\s*($Lval)\s*\)@) {
|
||||
my $array = $1;
|
||||
if ($line =~ m@\b(sizeof\s*\(\s*\Q$array\E\s*\)\s*/\s*sizeof\s*\(\s*\Q$array\E\s*\[\s*0\s*\]\s*\))@) {
|
||||
my $array_div = $1;
|
||||
if (WARN("ARRAY_SIZE",
|
||||
"Prefer ARRAY_SIZE($array)\n" . $herecurr) &&
|
||||
$fix) {
|
||||
$fixed[$fixlinenr] =~ s/\Q$array_div\E/ARRAY_SIZE($array)/;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# check for function declarations without arguments like "int foo()"
|
||||
if ($line =~ /(\b$Type\s*$Ident)\s*\(\s*\)/) {
|
||||
if (ERROR("FUNCTION_WITHOUT_ARGS",
|
||||
|
|
Loading…
Reference in a new issue