|
@@ -4522,6 +4522,20 @@ sub process {
|
|
|
"Possible precedence defect with mask then right shift - may need parentheses\n" . $herecurr);
|
|
|
}
|
|
|
|
|
|
+# check for pointer comparisons to NULL
|
|
|
+ if ($^V && $^V ge 5.10.0) {
|
|
|
+ while ($line =~ /\b$LvalOrFunc\s*(==|\!=)\s*NULL\b/g) {
|
|
|
+ my $val = $1;
|
|
|
+ my $equal = "!";
|
|
|
+ $equal = "" if ($4 eq "!=");
|
|
|
+ if (CHK("COMPARISON_TO_NULL",
|
|
|
+ "Comparison to NULL could be written \"${equal}${val}\"\n" . $herecurr) &&
|
|
|
+ $fix) {
|
|
|
+ $fixed[$fixlinenr] =~ s/\b\Q$val\E\s*(?:==|\!=)\s*NULL\b/$equal$val/;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
# check for bad placement of section $InitAttribute (e.g.: __initdata)
|
|
|
if ($line =~ /(\b$InitAttribute\b)/) {
|
|
|
my $attr = $1;
|