Delete the unnecessary ERR and ERRC lines in makefiles, add some functionality
authorDr. Stephen Henson <steve@openssl.org>
Sat, 24 Apr 1999 13:28:57 +0000 (13:28 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Sat, 24 Apr 1999 13:28:57 +0000 (13:28 +0000)
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.

26 files changed:
CHANGES
crypto/Makefile.ssl
crypto/asn1/Makefile.ssl
crypto/bio/Makefile.ssl
crypto/bn/Makefile.ssl
crypto/buffer/Makefile.ssl
crypto/comp/Makefile.ssl
crypto/conf/Makefile.ssl
crypto/dh/Makefile.ssl
crypto/dsa/Makefile.ssl
crypto/evp/Makefile.ssl
crypto/objects/Makefile.ssl
crypto/pem/Makefile.ssl
crypto/pkcs12/Makefile.ssl
crypto/pkcs12/p12_add.c
crypto/pkcs12/p12_attr.c
crypto/pkcs12/p12_mutl.c
crypto/pkcs12/pk12err.c
crypto/pkcs12/pkcs12.h
crypto/pkcs7/Makefile.ssl
crypto/rsa/Makefile.ssl
crypto/x509/Makefile.ssl
crypto/x509v3/Makefile.ssl
rsaref/Makefile.ssl
ssl/Makefile.ssl
util/mkerr.pl

diff --git a/CHANGES b/CHANGES
index bc74b8bfd2ffc8cde56f56c764c1de732222a43d..4a0d597d769698e3161a9dd1bb22d67513f56f41 100644 (file)
--- 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 <foo.h> to <openssl/foo.h>.
index dbb195027ff747a2df1b7602750a0706c4187b7a..e4a0c221ea0cd5d6c61fc7b904a0eb243514fb11 100644 (file)
@@ -20,8 +20,6 @@ EX_LIBS=
  
 CFLAGS= $(INCLUDE) $(CFLAG) -DCFLAGS="\"$(CC) $(CFLAG)\"" -DPLATFORM="\"$(PLATFORM)\""
 
-ERR=crypto
-ERRC=cpt_err
 
 LIBS=
 
index 7c9c5d789bfe96c146169220a2b9af32f7ba4a4f..284a989fbac7e3839a5f7ca5e4fc65f9848cd851 100644 (file)
@@ -15,8 +15,6 @@ AR=           ar r
 
 CFLAGS= $(INCLUDES) $(CFLAG)
 
-ERR=asn1
-ERRC=asn1_err
 GENERAL=Makefile README
 TEST=
 APPS=
index a80b449e998d3732e786ee1a5e79adf88707d3ae..1d7f83c7828a32ec506d19bd1eead0deeb04797f 100644 (file)
@@ -15,8 +15,6 @@ AR=           ar r
 
 CFLAGS= $(INCLUDES) $(CFLAG)
 
-ERR=bio
-ERRC=bio_err
 GENERAL=Makefile
 TEST=
 APPS=
index b36475df1147874c20ea3f4afc2a15953d7b0299..fffd15090bc02d58dee3503f0dbc3d5d6bc11ee8 100644 (file)
@@ -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=
index d7ef1a441367fcb22a66f3087103fe6229216869..4904761672363fb31627691ba5cce755d2929d20 100644 (file)
@@ -15,8 +15,6 @@ AR=           ar r
 
 CFLAGS= $(INCLUDES) $(CFLAG)
 
-ERR=buffer
-ERRC=buf_err
 GENERAL=Makefile
 TEST=
 APPS=
index dccd2ec36a2c0a60c1adc21dec8e5350eba8cf1f..89620a8fc8edabf24df20532c50d454692ca9398 100644 (file)
@@ -15,8 +15,6 @@ AR=           ar r
 
 CFLAGS= $(INCLUDES) $(CFLAG)
 
-ERR=comp
-ERRC=comp_err
 GENERAL=Makefile
 TEST=
 APPS=
index 54feb664f1fa7196ee69940f5e1106606899970d..28f7f6125f9777fd016ab48cff7f72f4cdb7704c 100644 (file)
@@ -15,8 +15,6 @@ AR=           ar r
 
 CFLAGS= $(INCLUDES) $(CFLAG)
 
-ERR=conf
-ERRC=conf_err
 GENERAL=Makefile
 TEST=
 APPS=
index a74c1281f0bb1cc8b2b3953a6888ab14c4f96e95..8fc3fe853430136c86fb31bf1ffe631f0ce51728 100644 (file)
@@ -15,8 +15,6 @@ AR=           ar r
 
 CFLAGS= $(INCLUDES) $(CFLAG)
 
-ERR=dh
-ERRC=dh_err
 GENERAL=Makefile
 TEST= dhtest.c
 APPS=
index 6292943559ee7ee9bf8dababf74b6e04f798e957..850229d4edfa72f7d16b54cda4c42f0120fb7b92 100644 (file)
@@ -15,8 +15,6 @@ AR=           ar r
 
 CFLAGS= $(INCLUDES) $(CFLAG)
 
-ERR=dsa
-ERRC=dsa_err
 GENERAL=Makefile
 TEST=dsatest.c
 APPS=
index 8761307865c1d84acd3f7ca584ba1a8b17670174..b74ad11be808ca56b7256033c7119e3c19677f2c 100644 (file)
@@ -15,8 +15,6 @@ AR=           ar r
 
 CFLAGS= $(INCLUDES) $(CFLAG)
 
-ERR=evp
-ERRC=evp_err
 GENERAL=Makefile
 TEST=
 APPS=
index 8accd348e7b7a773f7d91678590d05d0e3514321..eca022346fa335d1cdee010a5cea0c04d7956bb5 100644 (file)
@@ -15,8 +15,6 @@ AR=           ar r
 
 CFLAGS= $(INCLUDES) $(CFLAG)
 
-ERR=objects
-ERRC=obj_err
 GENERAL=Makefile README
 TEST=
 APPS=
index 44dc6c577bc0d8292f88bec64c3b2cd532149fc3..5470df3476fa531de43a34dfa42eebcc6600468b 100644 (file)
@@ -15,8 +15,6 @@ AR=           ar r
 
 CFLAGS= $(INCLUDES) $(CFLAG)
 
-ERR=pem
-ERRC=pem_err
 GENERAL=Makefile
 TEST=
 APPS=
index 4d1aac349b381d1991c7beeb4e9fac2fb10135e6..b4d5a53941f14ae79aa4bef6ff137628a9d5397a 100644 (file)
@@ -15,8 +15,6 @@ AR=           ar r
 
 CFLAGS= $(INCLUDES) $(CFLAG)
 
-ERR=pkcs12
-ERRC=pk12err
 GENERAL=Makefile
 TEST=
 APPS=
index 3e203a10308d8451ff71de9d5a7138c619f76a9c..b5858d1a109f2e7cf12971e1a52f57e46f03d311 100644 (file)
@@ -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;
        }
        
index 220d7a67ea5b532fbff227ce05dbb4551ace97a8..0bd91e388c1cbb156edb8714e006cd87acaf2211 100644 (file)
@@ -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);
index 2e9c31d97a195ab67b7a2f877c1d60426709049c..d1c35ea05aa501c949a983e60df76a6711aa540e 100644 (file)
@@ -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;
index c02ff00c6fe4e992dfd48d839a2fdc67e691f517..16492456ee104db1908f72f0a5373162956e0c84 100644 (file)
 #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);
+       }
index 4dd0d289555c608d3ade1bfb05abbbde07fc023a..4ba27db171028330a1c61e6fdba33a3a1932ece6 100644 (file)
@@ -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
index 65e4459169bd0cfc88e4b48901dee3f17b876f7a..e81cb1bba4fa65b3ce2a42684da8b1dc43f18c5b 100644 (file)
@@ -15,8 +15,6 @@ AR=           ar r
 
 CFLAGS= $(INCLUDES) $(CFLAG)
 
-ERR=pkcs7
-ERRC=pkcs7err
 GENERAL=Makefile README
 TEST=
 APPS=
index 1af5d61c3e7ed1c60f658dd16075643f0504eb80..cd90ff5481ae7c9d823e1c57afa9fb6a563accf7 100644 (file)
@@ -15,8 +15,6 @@ AR=           ar r
 
 CFLAGS= $(INCLUDES) $(CFLAG)
 
-ERR=rsa
-ERRC=rsa_err
 GENERAL=Makefile
 TEST=rsa_oaep_test.c
 APPS=
index 1d4cd05bba6321019df6a0bcf8d254f4bb43bab1..90ff87c002f43bbc9798628b661f8adfab0ecb76 100644 (file)
@@ -15,8 +15,6 @@ AR=           ar r
 
 CFLAGS= $(INCLUDES) $(CFLAG)
 
-ERR=x509
-ERRC=x509_err
 GENERAL=Makefile README
 TEST=
 APPS=
index 4e12faa75b163ee289b11b4dc99ab4ba2689a1ac..a46f10a20923e1adfb5f84c63adcf254393705c7 100644 (file)
@@ -15,8 +15,6 @@ AR=           ar r
 
 CFLAGS= $(INCLUDES) $(CFLAG)
 
-ERR=x509v3
-ERRC=v3err
 GENERAL=Makefile README
 TEST=
 APPS=
index 1b16b881df9f587b3c32e34ace175c97d41d93be..002513fa89cdb1aee51cf9630be8496fdf52eaf4 100644 (file)
@@ -15,8 +15,6 @@ AR=           ar r
 
 CFLAGS= $(INCLUDES) $(CFLAG)
 
-ERR=rsaref
-ERRC=rsar_err
 GENERAL=Makefile
 TEST=
 APPS=
index a4211ac3a01e067c54f1df267f1ad42d2c5b3460..c51454f293bb39481f401c0859af8adaedc173b2 100644 (file)
@@ -15,8 +15,6 @@ AR=           ar r
 
 CFLAGS= $(INCLUDES) $(CFLAG)
 
-ERR=ssl
-ERRC=ssl_err
 GENERAL=Makefile README
 TEST=ssltest.c
 APPS=
index 062619de50d9965cc178c58715a8bd7ac74c9a90..0293b0be7d233bd992f5a0d057f92594031fa2ae 100644 (file)
@@ -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(<IN>) {
-               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";
        }