From e3eaf8ea040bea082e4318b6bd56c97e3ea410cf Mon Sep 17 00:00:00 2001 From: short <> Date: Sat, 23 Feb 2002 22:52:57 +0000 Subject: [PATCH 1/1] Implemented option --nm for alternate "nm" command specification Implemented option --noheaders to disable headers checking at all Fixed false "global singularity" reporting --- bin/checkstatic | 42 +++++++++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/bin/checkstatic b/bin/checkstatic index 0d3395a..8dc611a 100755 --- a/bin/checkstatic +++ b/bin/checkstatic @@ -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 () { chomp; @@ -61,20 +67,22 @@ while () { } close NM; -open(CTAGS,"-|",'find -name "*.h"|xargs ctags -f - --c-types=xp') - or die "Cannot get ctags output: $!"; -while () { - 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 () { + 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}); } -- 1.8.3.1