diff options
Diffstat (limited to 'lib/checksrc.pl')
-rwxr-xr-x | lib/checksrc.pl | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/checksrc.pl b/lib/checksrc.pl index cbd204adb..311b819d5 100755 --- a/lib/checksrc.pl +++ b/lib/checksrc.pl @@ -81,6 +81,7 @@ my %warnings = ( 'SIZEOFNOPAREN' => 'use of sizeof without parentheses', 'SNPRINTF' => 'use of snprintf', 'ONELINECONDITION' => 'conditional block on the same line as the if()', + 'TYPEDEFSTRUCT' => 'typedefed struct', ); sub readwhitelist { @@ -116,6 +117,14 @@ sub readlocalfile { } $warnings{$1} = $warnings_extended{$1}; } + elsif (/^\s*disable ([A-Z]+)$/) { + if(!defined($warnings{$1})) { + print STDERR "invalid warning specified in .checksrc: \"$1\"\n"; + next; + } + # Accept-list + push @alist, $1; + } else { die "Invalid format in $dir/.checksrc on line $i\n"; } @@ -698,6 +707,13 @@ sub scanfile { "no space after semicolon"); } + # typedef struct ... { + if($nostr =~ /^(.*)typedef struct.*{/) { + checkwarn("TYPEDEFSTRUCT", + $line, length($1)+1, $file, $ol, + "typedef'ed struct"); + } + # check for more than one consecutive space before open brace or # question mark. Skip lines containing strings since they make it hard # due to artificially getting multiple spaces |