From 6e781e8e076545b5a15e189bbaccbd7aae60d03b Mon Sep 17 00:00:00 2001 From: "Dr. Stephen Henson" Date: Sat, 24 Apr 1999 13:28:57 +0000 Subject: [PATCH] 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. --- CHANGES | 3 ++- crypto/Makefile.ssl | 2 -- crypto/asn1/Makefile.ssl | 2 -- crypto/bio/Makefile.ssl | 2 -- crypto/bn/Makefile.ssl | 2 -- crypto/buffer/Makefile.ssl | 2 -- crypto/comp/Makefile.ssl | 2 -- crypto/conf/Makefile.ssl | 2 -- crypto/dh/Makefile.ssl | 2 -- crypto/dsa/Makefile.ssl | 2 -- crypto/evp/Makefile.ssl | 2 -- crypto/objects/Makefile.ssl | 2 -- crypto/pem/Makefile.ssl | 2 -- crypto/pkcs12/Makefile.ssl | 2 -- crypto/pkcs12/p12_add.c | 6 +++--- crypto/pkcs12/p12_attr.c | 21 ++++++++++++------- crypto/pkcs12/p12_mutl.c | 6 +++--- crypto/pkcs12/pk12err.c | 42 +++++++++++++++++++++++++++++++------ crypto/pkcs12/pkcs12.h | 10 ++++----- crypto/pkcs7/Makefile.ssl | 2 -- crypto/rsa/Makefile.ssl | 2 -- crypto/x509/Makefile.ssl | 2 -- crypto/x509v3/Makefile.ssl | 2 -- rsaref/Makefile.ssl | 2 -- ssl/Makefile.ssl | 2 -- util/mkerr.pl | 39 +++++++++++++++++++++++++++++----- 26 files changed, 96 insertions(+), 69 deletions(-) diff --git a/CHANGES b/CHANGES index bc74b8bfd2..4a0d597d76 100644 --- a/CHANGES +++ b/CHANGES @@ -13,7 +13,8 @@ aren't needed for error creation any more) and do a better job of translating function codes into names. The old 'ASN1 error code imbedded in a comment' is no longer necessary and it doesn't use .err files which - have now been deleted. + have now been deleted. Also the error code call doesn't have to appear all + on one line (which resulted in some large lines...). [Steve Henson] *) Change #include filenames from to . diff --git a/crypto/Makefile.ssl b/crypto/Makefile.ssl index dbb195027f..e4a0c221ea 100644 --- a/crypto/Makefile.ssl +++ b/crypto/Makefile.ssl @@ -20,8 +20,6 @@ EX_LIBS= CFLAGS= $(INCLUDE) $(CFLAG) -DCFLAGS="\"$(CC) $(CFLAG)\"" -DPLATFORM="\"$(PLATFORM)\"" -ERR=crypto -ERRC=cpt_err LIBS= diff --git a/crypto/asn1/Makefile.ssl b/crypto/asn1/Makefile.ssl index 7c9c5d789b..284a989fba 100644 --- a/crypto/asn1/Makefile.ssl +++ b/crypto/asn1/Makefile.ssl @@ -15,8 +15,6 @@ AR= ar r CFLAGS= $(INCLUDES) $(CFLAG) -ERR=asn1 -ERRC=asn1_err GENERAL=Makefile README TEST= APPS= diff --git a/crypto/bio/Makefile.ssl b/crypto/bio/Makefile.ssl index a80b449e99..1d7f83c782 100644 --- a/crypto/bio/Makefile.ssl +++ b/crypto/bio/Makefile.ssl @@ -15,8 +15,6 @@ AR= ar r CFLAGS= $(INCLUDES) $(CFLAG) -ERR=bio -ERRC=bio_err GENERAL=Makefile TEST= APPS= diff --git a/crypto/bn/Makefile.ssl b/crypto/bn/Makefile.ssl index b36475df11..fffd15090b 100644 --- a/crypto/bn/Makefile.ssl +++ b/crypto/bn/Makefile.ssl @@ -19,8 +19,6 @@ BN_ASM= bn_asm.o CFLAGS= $(INCLUDES) $(CFLAG) -ERR=bn -ERRC=bn_err GENERAL=Makefile TEST=bntest.c exptest.c APPS= diff --git a/crypto/buffer/Makefile.ssl b/crypto/buffer/Makefile.ssl index d7ef1a4413..4904761672 100644 --- a/crypto/buffer/Makefile.ssl +++ b/crypto/buffer/Makefile.ssl @@ -15,8 +15,6 @@ AR= ar r CFLAGS= $(INCLUDES) $(CFLAG) -ERR=buffer -ERRC=buf_err GENERAL=Makefile TEST= APPS= diff --git a/crypto/comp/Makefile.ssl b/crypto/comp/Makefile.ssl index dccd2ec36a..89620a8fc8 100644 --- a/crypto/comp/Makefile.ssl +++ b/crypto/comp/Makefile.ssl @@ -15,8 +15,6 @@ AR= ar r CFLAGS= $(INCLUDES) $(CFLAG) -ERR=comp -ERRC=comp_err GENERAL=Makefile TEST= APPS= diff --git a/crypto/conf/Makefile.ssl b/crypto/conf/Makefile.ssl index 54feb664f1..28f7f6125f 100644 --- a/crypto/conf/Makefile.ssl +++ b/crypto/conf/Makefile.ssl @@ -15,8 +15,6 @@ AR= ar r CFLAGS= $(INCLUDES) $(CFLAG) -ERR=conf -ERRC=conf_err GENERAL=Makefile TEST= APPS= diff --git a/crypto/dh/Makefile.ssl b/crypto/dh/Makefile.ssl index a74c1281f0..8fc3fe8534 100644 --- a/crypto/dh/Makefile.ssl +++ b/crypto/dh/Makefile.ssl @@ -15,8 +15,6 @@ AR= ar r CFLAGS= $(INCLUDES) $(CFLAG) -ERR=dh -ERRC=dh_err GENERAL=Makefile TEST= dhtest.c APPS= diff --git a/crypto/dsa/Makefile.ssl b/crypto/dsa/Makefile.ssl index 6292943559..850229d4ed 100644 --- a/crypto/dsa/Makefile.ssl +++ b/crypto/dsa/Makefile.ssl @@ -15,8 +15,6 @@ AR= ar r CFLAGS= $(INCLUDES) $(CFLAG) -ERR=dsa -ERRC=dsa_err GENERAL=Makefile TEST=dsatest.c APPS= diff --git a/crypto/evp/Makefile.ssl b/crypto/evp/Makefile.ssl index 8761307865..b74ad11be8 100644 --- a/crypto/evp/Makefile.ssl +++ b/crypto/evp/Makefile.ssl @@ -15,8 +15,6 @@ AR= ar r CFLAGS= $(INCLUDES) $(CFLAG) -ERR=evp -ERRC=evp_err GENERAL=Makefile TEST= APPS= diff --git a/crypto/objects/Makefile.ssl b/crypto/objects/Makefile.ssl index 8accd348e7..eca022346f 100644 --- a/crypto/objects/Makefile.ssl +++ b/crypto/objects/Makefile.ssl @@ -15,8 +15,6 @@ AR= ar r CFLAGS= $(INCLUDES) $(CFLAG) -ERR=objects -ERRC=obj_err GENERAL=Makefile README TEST= APPS= diff --git a/crypto/pem/Makefile.ssl b/crypto/pem/Makefile.ssl index 44dc6c577b..5470df3476 100644 --- a/crypto/pem/Makefile.ssl +++ b/crypto/pem/Makefile.ssl @@ -15,8 +15,6 @@ AR= ar r CFLAGS= $(INCLUDES) $(CFLAG) -ERR=pem -ERRC=pem_err GENERAL=Makefile TEST= APPS= diff --git a/crypto/pkcs12/Makefile.ssl b/crypto/pkcs12/Makefile.ssl index 4d1aac349b..b4d5a53941 100644 --- a/crypto/pkcs12/Makefile.ssl +++ b/crypto/pkcs12/Makefile.ssl @@ -15,8 +15,6 @@ AR= ar r CFLAGS= $(INCLUDES) $(CFLAG) -ERR=pkcs12 -ERRC=pk12err GENERAL=Makefile TEST= APPS= diff --git a/crypto/pkcs12/p12_add.c b/crypto/pkcs12/p12_add.c index 3e203a1030..b5858d1a10 100644 --- a/crypto/pkcs12/p12_add.c +++ b/crypto/pkcs12/p12_add.c @@ -91,7 +91,7 @@ PKCS12_SAFEBAG *PKCS12_MAKE_KEYBAG (PKCS8_PRIV_KEY_INFO *p8) { PKCS12_SAFEBAG *bag; if (!(bag = PKCS12_SAFEBAG_new())) { - PKCS12err(PKCS12_F_PKCS12_MAKE_SAFEBAG, ERR_R_MALLOC_FAILURE); + PKCS12err(PKCS12_F_PKCS12_MAKE_KEYBAG,ERR_R_MALLOC_FAILURE); return NULL; } bag->type = OBJ_nid2obj(NID_keyBag); @@ -128,12 +128,12 @@ PKCS7 *PKCS12_pack_p7data (STACK *sk) { PKCS7 *p7; if (!(p7 = PKCS7_new())) { - PKCS12err(PKCS12_F_PKCS12_PACK_P7_DATA, ERR_R_MALLOC_FAILURE); + PKCS12err(PKCS12_F_PKCS12_PACK_P7DATA, ERR_R_MALLOC_FAILURE); return NULL; } p7->type = OBJ_nid2obj(NID_pkcs7_data); if (!(p7->d.data = ASN1_OCTET_STRING_new())) { - PKCS12err(PKCS12_F_PKCS12_PACK_P7_DATA, ERR_R_MALLOC_FAILURE); + PKCS12err(PKCS12_F_PKCS12_PACK_P7DATA, ERR_R_MALLOC_FAILURE); return NULL; } diff --git a/crypto/pkcs12/p12_attr.c b/crypto/pkcs12/p12_attr.c index 220d7a67ea..0bd91e388c 100644 --- a/crypto/pkcs12/p12_attr.c +++ b/crypto/pkcs12/p12_attr.c @@ -151,7 +151,8 @@ int PKCS12_add_friendlyname_asc (PKCS12_SAFEBAG *bag, const char *name, unsigned char *uniname; int ret, unilen; if (!asc2uni(name, &uniname, &unilen)) { - PKCS12err(PKCS12_F_ADD_FRIENDLYNAME_ASC,ERR_R_MALLOC_FAILURE); + PKCS12err(PKCS12_F_PKCS12_ADD_FRIENDLYNAME_ASC, + ERR_R_MALLOC_FAILURE); return 0; } ret = PKCS12_add_friendlyname_uni (bag, uniname, unilen); @@ -169,34 +170,40 @@ int PKCS12_add_friendlyname_uni (PKCS12_SAFEBAG *bag, /* Zap ending double null if included */ if(!name[namelen - 1] && !name[namelen - 2]) namelen -= 2; if (!(fname = ASN1_TYPE_new ())) { - PKCS12err(PKCS12_F_ADD_FRIENDLYNAME_UNI,ERR_R_MALLOC_FAILURE); + PKCS12err(PKCS12_F_PKCS12_ADD_FRIENDLYNAME_UNI, + ERR_R_MALLOC_FAILURE); return 0; } fname->type = V_ASN1_BMPSTRING; if (!(bmp = ASN1_BMPSTRING_new())) { - PKCS12err(PKCS12_F_ADD_FRIENDLYNAME_UNI,ERR_R_MALLOC_FAILURE); + PKCS12err(PKCS12_F_PKCS12_ADD_FRIENDLYNAME_UNI, + ERR_R_MALLOC_FAILURE); return 0; } if (!(bmp->data = Malloc (namelen))) { - PKCS12err(PKCS12_F_ADD_FRIENDLYNAME_UNI,ERR_R_MALLOC_FAILURE); + PKCS12err(PKCS12_F_PKCS12_ADD_FRIENDLYNAME_UNI, + ERR_R_MALLOC_FAILURE); return 0; } memcpy (bmp->data, name, namelen); bmp->length = namelen; fname->value.bmpstring = bmp; if (!(attrib = X509_ATTRIBUTE_new ())) { - PKCS12err(PKCS12_F_ADD_FRIENDLYNAME_UNI,ERR_R_MALLOC_FAILURE); + PKCS12err(PKCS12_F_PKCS12_ADD_FRIENDLYNAME_UNI, + ERR_R_MALLOC_FAILURE); return 0; } attrib->object = OBJ_nid2obj(NID_friendlyName); if (!(attrib->value.set = sk_new(NULL))) { - PKCS12err(PKCS12_F_ADD_FRIENDLYNAME,ERR_R_MALLOC_FAILURE); + PKCS12err(PKCS12_F_PKCS12_ADD_FRIENDLYNAME, + ERR_R_MALLOC_FAILURE); return 0; } sk_push (attrib->value.set, (char *)fname); attrib->set = 1; if (!bag->attrib && !(bag->attrib = sk_new (NULL))) { - PKCS12err(PKCS12_F_ADD_FRIENDLYNAME_UNI, ERR_R_MALLOC_FAILURE); + PKCS12err(PKCS12_F_PKCS12_ADD_FRIENDLYNAME_UNI, + ERR_R_MALLOC_FAILURE); return 0; } sk_push (bag->attrib, (char *)attrib); diff --git a/crypto/pkcs12/p12_mutl.c b/crypto/pkcs12/p12_mutl.c index 2e9c31d97a..d1c35ea05a 100644 --- a/crypto/pkcs12/p12_mutl.c +++ b/crypto/pkcs12/p12_mutl.c @@ -123,15 +123,15 @@ int PKCS12_set_mac (PKCS12 *p12, const char *pass, int passlen, if (!md_type) md_type = EVP_sha1(); if (PKCS12_setup_mac (p12, iter, salt, saltlen, md_type) == PKCS12_ERROR) { - PKCS12err(PKCS12_F_PKCS12_SET_MAC, PKCS12_R_MAC_SETUP_ERROR); + PKCS12err(PKCS12_F_PKCS12_SET_MAC,PKCS12_R_MAC_SETUP_ERROR); return 0; } if (!PKCS12_gen_mac (p12, pass, passlen, mac, &maclen)) { - PKCS12err(PKCS12_F_PKCS12_SET_MAC, PKCS12_R_MAC_GENERATION_ERROR); + PKCS12err(PKCS12_F_PKCS12_SET_MAC,PKCS12_R_MAC_GENERATION_ERROR); return 0; } if (!(ASN1_OCTET_STRING_set (p12->mac->dinfo->digest, mac, maclen))) { - PKCS12err(PKCS12_F_PKCS12_PKCS12_SET_MAC,PKCS12_R_MAC_STRING_SET_ERROR); + PKCS12err(PKCS12_F_PKCS12_SET_MAC,PKCS12_R_MAC_STRING_SET_ERROR); return 0; } return 1; diff --git a/crypto/pkcs12/pk12err.c b/crypto/pkcs12/pk12err.c index c02ff00c6f..16492456ee 100644 --- a/crypto/pkcs12/pk12err.c +++ b/crypto/pkcs12/pk12err.c @@ -65,13 +65,14 @@ #ifndef NO_ERR static ERR_STRING_DATA PKCS12_str_functs[]= { -{ERR_PACK(0,PKCS12_F_ADD_FRIENDLYNAME,0), "ADD_FRIENDLYNAME"}, -{ERR_PACK(0,PKCS12_F_ADD_FRIENDLYNAME_ASC,0), "ADD_FRIENDLYNAME_ASC"}, -{ERR_PACK(0,PKCS12_F_ADD_FRIENDLYNAME_UNI,0), "ADD_FRIENDLYNAME_UNI"}, {ERR_PACK(0,PKCS12_F_PARSE_BAGS,0), "PARSE_BAGS"}, +{ERR_PACK(0,PKCS12_F_PKCS12_ADD_FRIENDLYNAME,0), "PKCS12_ADD_FRIENDLYNAME"}, +{ERR_PACK(0,PKCS12_F_PKCS12_ADD_FRIENDLYNAME_ASC,0), "PKCS12_add_friendlyname_asc"}, +{ERR_PACK(0,PKCS12_F_PKCS12_ADD_FRIENDLYNAME_UNI,0), "PKCS12_add_friendlyname_uni"}, {ERR_PACK(0,PKCS12_F_PKCS12_ADD_LOCALKEYID,0), "PKCS12_add_localkeyid"}, {ERR_PACK(0,PKCS12_F_PKCS12_CREATE,0), "PKCS12_create"}, {ERR_PACK(0,PKCS12_F_PKCS12_DECRYPT_D2I,0), "PKCS12_decrypt_d2i"}, +{ERR_PACK(0,PKCS12_F_PKCS12_FRIENDLYNAME_ASC,0), "PKCS12_FRIENDLYNAME_ASC"}, {ERR_PACK(0,PKCS12_F_PKCS12_GEN_MAC,0), "PKCS12_gen_mac"}, {ERR_PACK(0,PKCS12_F_PKCS12_I2D_ENCRYPT,0), "PKCS12_i2d_encrypt"}, {ERR_PACK(0,PKCS12_F_PKCS12_INIT,0), "PKCS12_init"}, @@ -122,17 +123,46 @@ static ERR_STRING_DATA PKCS12_str_reasons[]= #endif -void ERR_load_PKCS12_strings(void) +#ifdef PKCS12_LIB_NAME +static ERR_STRING_DATA PKCS12_lib_name[]= + { +{0 ,PKCS12_LIB_NAME}, +{0,NULL} + }; +#endif + + +int PKCS12_lib_error_code=0; + +void ERR_load_PKCS12_strings() { static int init=1; + if (PKCS12_lib_error_code == 0) + PKCS12_lib_error_code=ERR_get_next_error_library(); + if (init) { init=0; #ifndef NO_ERR - ERR_load_strings(ERR_LIB_PKCS12,PKCS12_str_functs); - ERR_load_strings(ERR_LIB_PKCS12,PKCS12_str_reasons); + ERR_load_strings(PKCS12_lib_error_code,PKCS12_str_functs); + ERR_load_strings(PKCS12_lib_error_code,PKCS12_str_reasons); #endif +#ifdef PKCS12_LIB_NAME + PKCS12_lib_name->error = ERR_PACK(PKCS12_lib_error_code,0,0); + ERR_load_strings(0,PKCS12_lib_name); +#endif; } } + +void ERR_PKCS12_error(function,reason,file,line) +int function; +int reason; +char *file; +int line; + { + if (PKCS12_lib_error_code == 0) + PKCS12_lib_error_code=ERR_get_next_error_library(); + ERR_PUT_error(PKCS12_lib_error_code,function,reason,file,line); + } diff --git a/crypto/pkcs12/pkcs12.h b/crypto/pkcs12/pkcs12.h index 4dd0d28955..4ba27db171 100644 --- a/crypto/pkcs12/pkcs12.h +++ b/crypto/pkcs12/pkcs12.h @@ -321,10 +321,10 @@ PKCS12 *d2i_PKCS12_fp(); /* Error codes for the PKCS12 functions. */ /* Function codes. */ -#define PKCS12_F_ADD_FRIENDLYNAME 100 -#define PKCS12_F_ADD_FRIENDLYNAME_ASC 101 -#define PKCS12_F_ADD_FRIENDLYNAME_UNI 102 #define PKCS12_F_PARSE_BAGS 103 +#define PKCS12_F_PKCS12_ADD_FRIENDLYNAME 100 +#define PKCS12_F_PKCS12_ADD_FRIENDLYNAME_ASC 127 +#define PKCS12_F_PKCS12_ADD_FRIENDLYNAME_UNI 102 #define PKCS12_F_PKCS12_ADD_LOCALKEYID 104 #define PKCS12_F_PKCS12_CREATE 105 #define PKCS12_F_PKCS12_DECRYPT_D2I 106 @@ -333,16 +333,14 @@ PKCS12 *d2i_PKCS12_fp(); #define PKCS12_F_PKCS12_INIT 109 #define PKCS12_F_PKCS12_KEY_GEN_ASC 110 #define PKCS12_F_PKCS12_KEY_GEN_UNI 111 -#define PKCS12_F_PKCS12_MAKE_SAFEBAG 112 +#define PKCS12_F_PKCS12_MAKE_KEYBAG 112 #define PKCS12_F_PKCS12_MAKE_SHKEYBAG 113 #define PKCS12_F_PKCS12_PACK_P7DATA 114 #define PKCS12_F_PKCS12_PACK_P7ENCDATA 115 -#define PKCS12_F_PKCS12_PACK_P7_DATA 116 #define PKCS12_F_PKCS12_PACK_SAFEBAG 117 #define PKCS12_F_PKCS12_PARSE 118 #define PKCS12_F_PKCS12_PBE_CRYPT 119 #define PKCS12_F_PKCS12_PBE_KEYIVGEN 120 -#define PKCS12_F_PKCS12_PKCS12_SET_MAC 121 #define PKCS12_F_PKCS12_SETUP_MAC 122 #define PKCS12_F_PKCS12_SET_MAC 123 #define PKCS12_F_PKCS8_ADD_KEYUSAGE 124 diff --git a/crypto/pkcs7/Makefile.ssl b/crypto/pkcs7/Makefile.ssl index 65e4459169..e81cb1bba4 100644 --- a/crypto/pkcs7/Makefile.ssl +++ b/crypto/pkcs7/Makefile.ssl @@ -15,8 +15,6 @@ AR= ar r CFLAGS= $(INCLUDES) $(CFLAG) -ERR=pkcs7 -ERRC=pkcs7err GENERAL=Makefile README TEST= APPS= diff --git a/crypto/rsa/Makefile.ssl b/crypto/rsa/Makefile.ssl index 1af5d61c3e..cd90ff5481 100644 --- a/crypto/rsa/Makefile.ssl +++ b/crypto/rsa/Makefile.ssl @@ -15,8 +15,6 @@ AR= ar r CFLAGS= $(INCLUDES) $(CFLAG) -ERR=rsa -ERRC=rsa_err GENERAL=Makefile TEST=rsa_oaep_test.c APPS= diff --git a/crypto/x509/Makefile.ssl b/crypto/x509/Makefile.ssl index 1d4cd05bba..90ff87c002 100644 --- a/crypto/x509/Makefile.ssl +++ b/crypto/x509/Makefile.ssl @@ -15,8 +15,6 @@ AR= ar r CFLAGS= $(INCLUDES) $(CFLAG) -ERR=x509 -ERRC=x509_err GENERAL=Makefile README TEST= APPS= diff --git a/crypto/x509v3/Makefile.ssl b/crypto/x509v3/Makefile.ssl index 4e12faa75b..a46f10a209 100644 --- a/crypto/x509v3/Makefile.ssl +++ b/crypto/x509v3/Makefile.ssl @@ -15,8 +15,6 @@ AR= ar r CFLAGS= $(INCLUDES) $(CFLAG) -ERR=x509v3 -ERRC=v3err GENERAL=Makefile README TEST= APPS= diff --git a/rsaref/Makefile.ssl b/rsaref/Makefile.ssl index 1b16b881df..002513fa89 100644 --- a/rsaref/Makefile.ssl +++ b/rsaref/Makefile.ssl @@ -15,8 +15,6 @@ AR= ar r CFLAGS= $(INCLUDES) $(CFLAG) -ERR=rsaref -ERRC=rsar_err GENERAL=Makefile TEST= APPS= diff --git a/ssl/Makefile.ssl b/ssl/Makefile.ssl index a4211ac3a0..c51454f293 100644 --- a/ssl/Makefile.ssl +++ b/ssl/Makefile.ssl @@ -15,8 +15,6 @@ AR= ar r CFLAGS= $(INCLUDES) $(CFLAG) -ERR=ssl -ERRC=ssl_err GENERAL=Makefile README TEST=ssltest.c APPS= 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"; } -- GitLab