diff options
author | Daniel Stenberg <daniel@haxx.se> | 2020-05-14 00:05:04 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2020-05-14 08:20:48 +0200 |
commit | 402b19dbfca724a20488d1f15964f10b8459b597 (patch) | |
tree | e2e69f51821f4ed5f176e5bfbda2fc754a9708a8 /lib/checksrc.pl | |
parent | e0d04e0c5fb970f4b7a117dcb8b481e077014ac3 (diff) | |
download | curl-402b19dbfca724a20488d1f15964f10b8459b597.tar.gz |
source cleanup: remove all custom typedef structsbagder/remove-typedef-structs
- Stick to a single unified way to use structs
- Make checksrc complain on 'typedef struct {'
- Allow them in tests, public headers and examples
- Let MD4_CTX, MD5_CTX, and SHA256_CTX typedefs remain as they actually
typedef different types/structs depending on build conditions.
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 |