mirror of
				https://github.com/cuberite/polarssl.git
				synced 2025-11-04 04:32:24 -05:00 
			
		
		
		
	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
					
				@ -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_([^_]+)/;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user