diff options
Diffstat (limited to 'lib/checksrc.pl')
-rwxr-xr-x | lib/checksrc.pl | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/checksrc.pl b/lib/checksrc.pl index c90e245ee..daff07bf5 100755 --- a/lib/checksrc.pl +++ b/lib/checksrc.pl @@ -63,6 +63,7 @@ my %warnings = ( 'NOSPACEEQUALS' => 'equals sign without preceding space', 'SEMINOSPACE' => 'semicolon without following space', 'MULTISPACE' => 'multiple spaces used when not suitable', + 'SIZEOFNOPAREN' => 'use of sizeof without parentheses', ); sub readwhitelist { @@ -417,6 +418,17 @@ sub scanfile { } } + # check for "sizeof" without parenthesis + if(($l =~ /^(.*)sizeof *([ (])/) && ($2 ne "(")) { + if($1 =~ / *\#/) { + # this is a #if, treat it differently + } + else { + checkwarn("SIZEOFNOPAREN", $line, length($1)+6, $file, $l, + "sizeof without parenthesis"); + } + } + # check for comma without space if($l =~ /^(.*),[^ \n]/) { my $pref=$1; |