Implemented option --nm for alternate "nm" command specification
authorshort <>
Sat, 23 Feb 2002 22:52:57 +0000 (22:52 +0000)
committershort <>
Sat, 23 Feb 2002 22:52:57 +0000 (22:52 +0000)
Implemented option --noheaders to disable headers checking at all
Fixed false "global singularity" reporting

bin/checkstatic

index 0d3395a..8dc611a 100755 (executable)
@@ -9,8 +9,14 @@ use Getopt::Long;
 
 my(%symtab)=();
 
-my($D);
-die if !GetOptions("d|debug+",\$D);
+my $D;
+my $opt_nm="nm";
+my $opt_headers=1;
+die if !GetOptions(
+               "d|debug+",\$D,
+               "nm=s"    ,\$opt_nm,
+               "headers!",\$opt_headers,
+               );
 
 
 sub defmiss
@@ -45,7 +51,7 @@ my(%sym)=@_;
                });
 }
 
-open(NM,"-|",'find -name "*.o"|xargs nm -f posix --print-file-name --no-sort --line-numbers')
+open(NM,"-|",'find -name "*.o"|xargs -- '.$opt_nm.' -f posix --print-file-name --no-sort --line-numbers')
                or die "Cannot get nm output: $!";
 while (<NM>) {
        chomp;
@@ -61,20 +67,22 @@ while (<NM>) {
        }
 close NM;
 
-open(CTAGS,"-|",'find -name "*.h"|xargs ctags -f - --c-types=xp')
-               or die "Cannot get ctags output: $!";
-while (<CTAGS>) {
-       chomp;
-       die "Line $. of ctags output not recognized: $_"
-               #     $1        $2            $3
-               if !/^([^\t]*)\t([^\t]*)\t.*\t(\w)$/;
-       storesym(
-               "name"=>$1,
-               "fn_c"=>$2,
-               "type"=>"c$3",
-               );
+if ($opt_headers) {
+       open(CTAGS,"-|",'find -name "*.h"|xargs ctags -f - --c-types=xp')
+                       or die "Cannot get ctags output: $!";
+       while (<CTAGS>) {
+               chomp;
+               die "Line $. of ctags output not recognized: $_"
+                       #     $1        $2            $3
+                       if !/^([^\t]*)\t([^\t]*)\t.*\t(\w)$/;
+               storesym(
+                       "name"=>$1,
+                       "fn_c"=>$2,
+                       "type"=>"c$3",
+                       );
+               }
+       close CTAGS;
        }
-close CTAGS;
 
 print Data::Dumper->Dump([\%symtab],["%symtab"]) if $D;
 
@@ -124,7 +132,7 @@ foreach $symname (sort keys %symtab) {
                }
 
 # >=1 n[:upper:]\U symbol && ==0 nU symbol => global singularity
-       if (@{refendef($ref=$$typesref{"n+"})}>=1 && @{refendef($$typesref{"n-"})}==0) {
+       if (@{refendef($ref=$$typesref{"n+"})}>=1 && @{refendef($$typesref{"nU"})}==0) {
                dumpsyms("global singularity",@{$ref});
                }