Another occurance of possible valgrind/purify "uninitialized memory"
[oweals/openssl.git] / util / mkerr.pl
index c8f305c4ea0c3dd6e018e6dbcacfb64b42787f10..6004853bc166ef1614e8cf26b7339711ccd42751 100644 (file)
@@ -13,6 +13,8 @@ my $staticloader = "";
 my $pack_errcode;
 my $load_errcode;
 
+my $errcount;
+
 while (@ARGV) {
        my $arg = $ARGV[0];
        if($arg eq "-conf") {
@@ -195,6 +197,7 @@ while (($hdr, $lib) = each %libinc)
                                $rcodes{$name} = $code;
                                if ($rassigned{$lib} =~ /:$code:/) {
                                        print STDERR "!! ERROR: $lib reason code $code assigned twice\n";
+                                       ++$errcount;
                                }
                                $rassigned{$lib} .= "$code:";
                                if(!(exists $rextra{$name}) &&
@@ -204,6 +207,7 @@ while (($hdr, $lib) = each %libinc)
                        } else {
                                if ($fassigned{$lib} =~ /:$code:/) {
                                        print STDERR "!! ERROR: $lib function code $code assigned twice\n";
+                                       ++$errcount;
                                }
                                $fassigned{$lib} .= "$code:";
                                if($code > $fmax{$lib}) {
@@ -234,6 +238,7 @@ while (($hdr, $lib) = each %libinc)
                if ($rmax{$lib} >= 1000) {
                        print STDERR "!! ERROR: SSL error codes 1000+ are reserved for alerts.\n";
                        print STDERR "!!        Any new alerts must be added to $config.\n";
+                       ++$errcount;
                        print STDERR "\n";
                }
        }
@@ -316,7 +321,7 @@ foreach $lib (keys %csrc)
        } else {
            push @out,
 "/* ====================================================================\n",
-" * Copyright (c) 2001-2007 The OpenSSL Project.  All rights reserved.\n",
+" * Copyright (c) 2001-2008 The OpenSSL Project.  All rights reserved.\n",
 " *\n",
 " * Redistribution and use in source and binary forms, with or without\n",
 " * modification, are permitted provided that the following conditions\n",
@@ -372,6 +377,10 @@ foreach $lib (keys %csrc)
 "#ifndef HEADER_${lib}_ERR_H\n",
 "#define HEADER_${lib}_ERR_H\n",
 "\n",
+"#ifdef  __cplusplus\n",
+"extern \"C\" {\n",
+"#endif\n",
+"\n",
 "/* BEGIN ERROR CODES */\n";
        }
        open (OUT, ">$hfile") || die "Can't Open File $hfile for writing\n";
@@ -723,3 +732,9 @@ if($debug && defined(@runref) ) {
                print STDERR "$_\n";
        }
 }
+
+if($errcount) {
+       print STDERR "There were errors, failing...\n\n";
+       exit $errcount;
+}
+