my $spelling_file = "$D/spelling.txt";
my $codespell = 0;
my $codespellfile = "/usr/share/codespell/dictionary.txt";
-my $conststructsfile = "$D/const_structs.checkpatch";
my $typedefsfile = "";
my $color = "auto";
my $allow_c99_comments = 1;
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 = "";
if (length($typedefsfile)) {
read_words(\$typeOtherTypedefs, $typedefsfile)
"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
# ignore definitions of NR_CPUS and usage to define arrays as likely right
if ($line =~ /\bNR_CPUS\b/ &&
done
echo "Done."
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
- 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
- cat $file | grep -v "normally be const" | grep -A3 "ERROR\|WARNING" 1>&2
+ result=$(cat $file | grep -A4 "ERROR\|WARNING")
fi
if [ "$?" -eq "0" ]; then
- stat=1
+ 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
+ fi
fi
done
fi