|
@@ -40,13 +40,13 @@ for $fn (@ARGV) {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (m!/\*.*?\*/!) {
|
|
if (m!/\*.*?\*/!) {
|
|
- s!/\*.*?\*/!!;
|
|
+ s!\s*/\*.*?\*/!!;
|
|
} elsif (m!/\*!) {
|
|
} elsif (m!/\*!) {
|
|
- s!/\*!!;
|
|
+ s!\s*/\*!!;
|
|
$incomment = 1;
|
|
$incomment = 1;
|
|
next;
|
|
next;
|
|
}
|
|
}
|
|
- s!"(?:[^\"]+|\\.)*"!!g;
|
|
+ s!"(?:[^\"]+|\\.)*"!"X"!g;
|
|
next if /^\#/;
|
|
next if /^\#/;
|
|
## Warn about C++-style comments.
|
|
## Warn about C++-style comments.
|
|
if (m!//!) {
|
|
if (m!//!) {
|
|
@@ -57,16 +57,8 @@ for $fn (@ARGV) {
|
|
if (/([^\s])\{/) {
|
|
if (/([^\s])\{/) {
|
|
print " $1\{:$fn:$.\n";
|
|
print " $1\{:$fn:$.\n";
|
|
}
|
|
}
|
|
- ## Warn about function calls with space before parens.
|
|
|
|
- if (/(\w+)\s\(/) {
|
|
|
|
- if ($1 ne "if" and $1 ne "while" and $1 ne "for" and
|
|
|
|
- $1 ne "switch" and $1 ne "return" and $1 ne "int" and
|
|
|
|
- $1 ne "void" and $1 ne "__attribute__") {
|
|
|
|
- print " fn ():$fn:$.\n";
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
## Warn about multiple internal spaces.
|
|
## Warn about multiple internal spaces.
|
|
- #if (/\S\s{2,}[^\s\\]/) {
|
|
+ #if (/[^\s,:]\s{2,}[^\s\\=]/) {
|
|
# print " X X:$fn:$.\n";
|
|
# print " X X:$fn:$.\n";
|
|
#}
|
|
#}
|
|
## Warn about { with stuff after.
|
|
## Warn about { with stuff after.
|
|
@@ -74,6 +66,14 @@ for $fn (@ARGV) {
|
|
#if (/\{[^\}\\]+$/) {
|
|
#if (/\{[^\}\\]+$/) {
|
|
# print " {X:$fn:$.\n";
|
|
# print " {X:$fn:$.\n";
|
|
#}
|
|
#}
|
|
|
|
+ ## Warn about function calls with space before parens.
|
|
|
|
+ if (/(\w+)\s\(/) {
|
|
|
|
+ if ($1 ne "if" and $1 ne "while" and $1 ne "for" and
|
|
|
|
+ $1 ne "switch" and $1 ne "return" and $1 ne "int" and
|
|
|
|
+ $1 ne "void" and $1 ne "__attribute__") {
|
|
|
|
+ print " fn ():$fn:$.\n";
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
close(F);
|
|
close(F);
|
|
}
|
|
}
|