mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-15 08:57:29 +00:00
tools: finer-grained error codes for checkpatch
* 2 for errors * 1 for warnings * 0 for clean * Suppress all report text for a clean result * Remove check for const structs from perl script * Remove grep suppression for that check from shell script Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
This commit is contained in:
parent
6f3835891a
commit
2580e72f8d
@ -55,7 +55,6 @@ my $min_conf_desc_length = 4;
|
|||||||
my $spelling_file = "$D/spelling.txt";
|
my $spelling_file = "$D/spelling.txt";
|
||||||
my $codespell = 0;
|
my $codespell = 0;
|
||||||
my $codespellfile = "/usr/share/codespell/dictionary.txt";
|
my $codespellfile = "/usr/share/codespell/dictionary.txt";
|
||||||
my $conststructsfile = "$D/const_structs.checkpatch";
|
|
||||||
my $typedefsfile = "";
|
my $typedefsfile = "";
|
||||||
my $color = "auto";
|
my $color = "auto";
|
||||||
my $allow_c99_comments = 1;
|
my $allow_c99_comments = 1;
|
||||||
@ -685,10 +684,6 @@ sub read_words {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
my $const_structs = "";
|
|
||||||
read_words(\$const_structs, $conststructsfile)
|
|
||||||
or warn "No structs that should be const will be found - file '$conststructsfile': $!\n";
|
|
||||||
|
|
||||||
my $typeOtherTypedefs = "";
|
my $typeOtherTypedefs = "";
|
||||||
if (length($typedefsfile)) {
|
if (length($typedefsfile)) {
|
||||||
read_words(\$typeOtherTypedefs, $typedefsfile)
|
read_words(\$typeOtherTypedefs, $typedefsfile)
|
||||||
@ -6197,14 +6192,6 @@ sub process {
|
|||||||
"please use device_initcall() or more appropriate function instead of __initcall() (see include/linux/init.h)\n" . $herecurr);
|
"please use device_initcall() or more appropriate function instead of __initcall() (see include/linux/init.h)\n" . $herecurr);
|
||||||
}
|
}
|
||||||
|
|
||||||
# check for various structs that are normally const (ops, kgdb, device_tree)
|
|
||||||
# and avoid what seem like struct definitions 'struct foo {'
|
|
||||||
if ($line !~ /\bconst\b/ &&
|
|
||||||
$line =~ /\bstruct\s+($const_structs)\b(?!\s*\{)/) {
|
|
||||||
WARN("CONST_STRUCT",
|
|
||||||
"struct $1 should normally be const\n" . $herecurr);
|
|
||||||
}
|
|
||||||
|
|
||||||
# use of NR_CPUS is usually wrong
|
# use of NR_CPUS is usually wrong
|
||||||
# ignore definitions of NR_CPUS and usage to define arrays as likely right
|
# ignore definitions of NR_CPUS and usage to define arrays as likely right
|
||||||
if ($line =~ /\bNR_CPUS\b/ &&
|
if ($line =~ /\bNR_CPUS\b/ &&
|
||||||
|
@ -69,16 +69,21 @@ else
|
|||||||
done
|
done
|
||||||
echo "Done."
|
echo "Done."
|
||||||
for file in /tmp/f1/*_cp; do
|
for file in /tmp/f1/*_cp; do
|
||||||
echo "Report for $(basename $file _cp)" 1>&2
|
|
||||||
echo "===============================================" 1>&2
|
|
||||||
if [ -a /tmp/f2/$(basename $file) ]; then
|
if [ -a /tmp/f2/$(basename $file) ]; then
|
||||||
diff $file /tmp/f2/$(basename $file) | grep -v "normally be const" | grep -A3 "ERROR\|WARNING" 1>&2
|
result=$(diff $file /tmp/f2/$(basename $file) | grep -A3 "ERROR\|WARNING")
|
||||||
else
|
else
|
||||||
cat $file | grep -v "normally be const" | grep -A3 "ERROR\|WARNING" 1>&2
|
result=$(cat $file | grep -A4 "ERROR\|WARNING")
|
||||||
fi
|
fi
|
||||||
if [ "$?" -eq "0" ]; then
|
if [ "$?" -eq "0" ]; then
|
||||||
|
echo "Report for $(basename $file _cp)" 1>&2
|
||||||
|
echo "===============================================" 1>&2
|
||||||
|
echo "$result" 1>&2
|
||||||
|
if echo $result | grep -q "ERROR"; then
|
||||||
|
stat=2
|
||||||
|
elif [ "$stat" -eq "0" ]; then
|
||||||
stat=1
|
stat=1
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user