summaryrefslogtreecommitdiffstats
path: root/bin/checkapi
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2013-05-21 17:30:54 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2013-05-21 17:30:54 (GMT)
commit424a41f878b9ac91f9411dcabc1b8358c7634ea1 (patch)
tree5361a19a29d57982f7db4e9c5206c6c45bc1cbca /bin/checkapi
parent7a3f473c04684c756c5398878b8b715320af94c1 (diff)
downloadhdf5-424a41f878b9ac91f9411dcabc1b8358c7634ea1.zip
hdf5-424a41f878b9ac91f9411dcabc1b8358c7634ea1.tar.gz
hdf5-424a41f878b9ac91f9411dcabc1b8358c7634ea1.tar.bz2
[svn-r23713] Description:
Clean up warnings, switch library code to use Standard C/POSIX wrapper macros, remove internal calls to API routines, update checkapi and checkposix scripts. Tested on: Mac OSX/64 10.8.3 (amazon) w/C++ & FORTRAN Big-Endian Linux/64 (ostrich)
Diffstat (limited to 'bin/checkapi')
-rwxr-xr-xbin/checkapi66
1 files changed, 42 insertions, 24 deletions
diff --git a/bin/checkapi b/bin/checkapi
index d21863b..b4a08e8 100755
--- a/bin/checkapi
+++ b/bin/checkapi
@@ -17,33 +17,51 @@ require 5.003;
# Purpose: insures that API functions aren't called internally.
# Usage: checkapi H5*.c
-my $comment = 0;
-while (<>) {
+my $filename = "";
+my $lastname = "";
- # Remove comments within the line.
- s/\/\*.*?\*\///g;
+if(<>) {
+ while (<>) {
+ if($ARGV =~ /\//) {
+ ($filename) = ($ARGV =~ /^.*\/([A-Za-z0-9_]*)\.c$/);
+ } else {
+ ($filename) = ($ARGV =~ /([A-Za-z0-9_]*)\.c$/);
+ }
- # Process comment begin and end tokens on this line.
- $comment-- if /\*\//; # count comment ends
- next if $comment; # skip line if in comment
- $comment++ if /\/\*/; # count comment starts
- s/(.*)\/\*.*/$1/; # remove comments that begin on this line
+ if($filename =~ /H5FDmulti|H5FDstdio/) {
+ if($filename ne $lastname) {
+ print "$ARGV is exempt from checking\n";
+ $lastname = $filename;
+ }
+ } else {
+ # Get rid of comments by removing the inside part.
+ s|/\*.*?\*/||g;
+ if ($in_comment) {
+ if (/\*\//) {
+ s|.*?\*/||;
+ $in_comment = 0;
+ } else {
+ $_="\n";
+ }
+ } elsif (m|/\*|) {
+ s|/\*.*||;
+ $in_comment = 1;
+ }
- # Remove character strings
- s/\\.//g; # remove escaped characters
- s/\".*?\"//g; # remove string constants
+ # Remove character strings
+ s/\\.//g; # remove escaped characters
+ s/\".*?\"//g; # remove string constants
- # Disregard the following hits
- next if /^H5/;
- next if /^\#/;
- next if /FUNC_ENTER(_NOINIT)*/;
+ # Disregard the following hits
+ next if /^H5/;
+ next if /^\#/;
+ next if /FUNC_ENTER(_NOINIT)*/;
- next unless /(H5[A-Z]{1,2}[a-z]\w*)/;
- print "$ARGV:$.: $1\n";
-} continue {
- if (eof) {
- print "$ARGV:$.: bad comment nesting\n" if $comment;
- $comment = 0;
- close ARGV; # reset line number
- }
+ next unless /(H5[A-Z]{1,2}[a-z]\w*)/;
+ print "$ARGV:$.: $1\n";
+ }
+ } continue {
+ close ARGV if eof; # reset line number
+ }
}
+