diff options
author | Martin Kaiser <wireshark@kaiser.cx> | 2013-03-16 09:53:19 +0000 |
---|---|---|
committer | Martin Kaiser <wireshark@kaiser.cx> | 2013-03-16 09:53:19 +0000 |
commit | c7dd35dffc56269e61decf1b0317c45573d3084d (patch) | |
tree | 8fce03aa6c35599384ac78e59b097b65efe092d6 /tools/checkAPIs.pl | |
parent | 20769a8bee881a71795cc3ba7ef6d2be6799d853 (diff) |
flag up a warning if someone includes gcrypt.h instead of wsutil/wsgcrypt.h
svn path=/trunk/; revision=48340
Diffstat (limited to 'tools/checkAPIs.pl')
-rwxr-xr-x | tools/checkAPIs.pl | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tools/checkAPIs.pl b/tools/checkAPIs.pl index d60146a902..65b643d21a 100755 --- a/tools/checkAPIs.pl +++ b/tools/checkAPIs.pl @@ -1407,6 +1407,26 @@ sub check_snprintf_plus_strlen($$) } } +sub check_included_files($$) +{ + my ($fileContentsRef, $filename) = @_; + my @incFiles; + + # wsutils/wsgcrypt.h is our wrapper around gcrypt.h, it must be excluded from the tests + if ($filename =~ /wsgcrypt\.h/) { + return; + } + + @incFiles = (${$fileContentsRef} =~ m/\#include \s* [<"](.+)[>"]/gox); + foreach (@incFiles) { + if ( m#(^|/+)gcrypt\.h$# ) { + print STDERR "Warning: ".$filename." includes gcrypt.h directly. ". + "Include wsutil/wsgrypt.h instead.\n"; + last; + } + } +} + sub check_proto_tree_add_XXX_encoding($$) { my ($fileContentsRef, $filename) = @_; @@ -1870,6 +1890,10 @@ while ($_ = $ARGV[0]) $errorCount += check_hf_entries(\$fileContents, $filename); } + # check for files that we should not include directly + # this must be done before quoted strings (#include "file.h") are removed + check_included_files(\$fileContents, $filename); + # Remove all the quoted strings $fileContents =~ s{ $DoubleQuotedStr | $SingleQuotedStr } []xog; |