generate_errors.pl now errors on duplicate codes

Duplication could easily happen during merges, now it can't go unnoticed.
This commit is contained in:
Manuel Pégourié-Gonnard 2015-01-22 13:19:20 +00:00
parent 59c6f2ef21
commit a9a991633d

View File

@ -56,13 +56,22 @@ my $hl_code_check = "";
my $headers = "";
my %error_codes_seen;
while (my $line = <GREP>)
{
next if ($line =~ /compat-1.2.h/);
my ($error_name, $error_code) = $line =~ /(POLARSSL_ERR_\w+)\s+\-(0x\w+)/;
my ($description) = $line =~ /\/\*\*< (.*?)\.? \*\//;
die "Duplicated error code: $error_code ($error_name)\n"
if( $error_codes_seen{$error_code}++ );
$description =~ s/\\/\\\\/g;
$description = "DESCRIPTION MISSING" if ($description eq "");
if ($description eq "") {
$description = "DESCRIPTION MISSING";
warn "Missing description for $error_name\n";
}
my ($module_name) = $error_name =~ /^POLARSSL_ERR_([^_]+)/;