From 6e781e8e076545b5a15e189bbaccbd7aae60d03b Mon Sep 17 00:00:00 2001 From: "Dr. Stephen Henson" Date: Sat, 24 Apr 1999 13:28:57 +0000 Subject: Delete the unnecessary ERR and ERRC lines in makefiles, add some functionality to error code script: it can now find untranslatable function codes (usually because the function is static and not defined in a header: occasionally because of a typo...) and unreferenced function and reason codes. To see this try: perl util/mkerr.pl -recurse -debug Also fixed some typos in crypto/pkcs12 that this found :-) Also tidy up some error calls that had to be all on one line: the old error script couldn't find codes unless the call was all on one line. --- util/mkerr.pl | 39 ++++++++++++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 5 deletions(-) (limited to 'util/mkerr.pl') diff --git a/util/mkerr.pl b/util/mkerr.pl index 062619de50..0293b0be7d 100644 --- a/util/mkerr.pl +++ b/util/mkerr.pl @@ -167,6 +167,8 @@ while (($lib, $hdr) = each %hinc) # oddly named structure BIO_F_CTX which needs to be ignored. # If a code doesn't exist in list compiled from headers then mark it # with the value "X" as a place holder to give it a value later. +# Store all function and reason codes found in %ufcodes and %urcodes +# so all those unreferenced can be printed out. foreach $file (@source) { @@ -174,16 +176,19 @@ foreach $file (@source) { next if exists $cskip{$file}; open(IN, "<$file") || die "Can't open source file $file\n"; while() { - if(/(([A-Z0-9]+)_F_[A-Z0-9_]+)/) { + if(/(([A-Z0-9]+)_F_([A-Z0-9_]+))/) { next unless exists $csrc{$2}; next if($1 eq "BIO_F_BUFFER_CTX"); + $ufcodes{$1} = 1; if(!exists $fcodes{$1}) { $fcodes{$1} = "X"; $fnew{$2}++; } + $notrans{$1} = 1 unless exists $ftrans{$3}; } if(/(([A-Z0-9]+)_R_[A-Z0-9_]+)/) { next unless exists $csrc{$2}; + $urcodes{$1} = 1; if(!exists $rcodes{$1}) { $rcodes{$1} = "X"; $rnew{$2}++; @@ -353,8 +358,6 @@ EOF $fn = $1; if(exists $ftrans{$fn}) { $fn = $ftrans{$fn}; - } else { - push @notrans, $i; } print OUT "{ERR_PACK(0,$i,0),\t\"$fn\"},\n"; } @@ -452,9 +455,35 @@ EOF } -if($debug && defined(@notrans)) { +if($debug && defined(%notrans)) { print STDERR "The following function codes were not translated:\n"; - foreach(@notrans) + foreach(sort keys %notrans) + { + print STDERR "$_\n"; + } +} + +# Make a list of unreferenced function and reason codes + +foreach (keys %fcodes) { + push (@funref, $_) unless exists $ufcodes{$_}; +} + +foreach (keys %rcodes) { + push (@runref, $_) unless exists $urcodes{$_}; +} + +if($debug && defined(@funref) ) { + print STDERR "The following function codes were not referenced:\n"; + foreach(sort @funref) + { + print STDERR "$_\n"; + } +} + +if($debug && defined(@runref) ) { + print STDERR "The following reason codes were not referenced:\n"; + foreach(sort @runref) { print STDERR "$_\n"; } -- cgit v1.2.3