@@ -3948,6 +3948,17 @@ sub process {
}
}
+# check for zero length array declarations in likely structs
+ if ($line =~ /^\+\t($Declare\s*$Ident)\s*\[\s*0\s*\]\s*;\s*$/ &&
+ defined $lines[$linenr] &&
+ $lines[$linenr] =~ /^[\+ ]\}\s*(?:__\w+\s*(?:$balanced_parens)?)\s*;\s*$/) {
+ if (WARN("FLEXIBLE_ARRAY_ZERO",
+ "Prefer flexible length array declarations with [] over [0]\n" . $herecurr) &&
+ $fix) {
+ $fixed[$fixlinenr] =~ s/\[\s*0\s*\]/[]/;
+ }
+ }
+
# check for multiple consecutive blank lines
if ($prevline =~ /^[\+ ]\s*$/ &&
$line =~ /^\+\s*$/ &&