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:
parent
59c6f2ef21
commit
a9a991633d
1 changed files with 10 additions and 1 deletions
|
@ -56,13 +56,22 @@ my $hl_code_check = "";
|
||||||
|
|
||||||
my $headers = "";
|
my $headers = "";
|
||||||
|
|
||||||
|
my %error_codes_seen;
|
||||||
|
|
||||||
while (my $line = <GREP>)
|
while (my $line = <GREP>)
|
||||||
{
|
{
|
||||||
next if ($line =~ /compat-1.2.h/);
|
next if ($line =~ /compat-1.2.h/);
|
||||||
my ($error_name, $error_code) = $line =~ /(POLARSSL_ERR_\w+)\s+\-(0x\w+)/;
|
my ($error_name, $error_code) = $line =~ /(POLARSSL_ERR_\w+)\s+\-(0x\w+)/;
|
||||||
my ($description) = $line =~ /\/\*\*< (.*?)\.? \*\//;
|
my ($description) = $line =~ /\/\*\*< (.*?)\.? \*\//;
|
||||||
|
|
||||||
|
die "Duplicated error code: $error_code ($error_name)\n"
|
||||||
|
if( $error_codes_seen{$error_code}++ );
|
||||||
|
|
||||||
$description =~ s/\\/\\\\/g;
|
$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_([^_]+)/;
|
my ($module_name) = $error_name =~ /^POLARSSL_ERR_([^_]+)/;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue