1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-07-28 00:21:48 +03:00

Updated generate_errors.pl to include private directories too: the header is deemed to be private if it is in a private subdirectory

Signed-off-by: Anton Matkin <anton.matkin@arm.com>
This commit is contained in:
Anton Matkin
2025-07-07 14:15:34 +02:00
parent a9ff1c4089
commit f94bc63fdb

View File

@ -52,6 +52,10 @@ close(FORMAT_FILE);
my @files = glob qq("$crypto_include_dir/*.h"); my @files = glob qq("$crypto_include_dir/*.h");
push(@files, glob qq("$tls_include_dir/*.h")); push(@files, glob qq("$tls_include_dir/*.h"));
push(@files, glob qq("$crypto_include_dir/private/*.h"));
push(@files, glob qq("$tls_include_dir/private/*.h"));
my @necessary_include_files; my @necessary_include_files;
my @matches; my @matches;
foreach my $file (@files) { foreach my $file (@files) {
@ -85,7 +89,7 @@ foreach my $file (@files) {
$description =~ s/^\s+//; $description =~ s/^\s+//;
$description =~ s/\n( *\*)? */ /g; $description =~ s/\n( *\*)? */ /g;
$description =~ s/\.?\s+$//; $description =~ s/\.?\s+$//;
push @matches, [$name, $value, $description]; push @matches, [$name, $value, $description, grep(/^.*private\/[^\/]+$/, $file)];
++$found; ++$found;
} }
if ($found) { if ($found) {
@ -109,7 +113,7 @@ my %error_codes_seen;
foreach my $match (@matches) foreach my $match (@matches)
{ {
my ($error_name, $error_code, $description) = @$match; my ($error_name, $error_code, $description, $is_private_header) = @$match;
die "Duplicated error code: $error_code ($error_name)\n" die "Duplicated error code: $error_code ($error_name)\n"
if( $error_codes_seen{$error_code}++ ); if( $error_codes_seen{$error_code}++ );
@ -203,6 +207,11 @@ foreach my $match (@matches)
if ($include_name ne ""); if ($include_name ne "");
} }
${$code_check} .= "\n"; ${$code_check} .= "\n";
if ($is_private_header) {
$include_name = "private/" . $include_name;
}
$headers .= "\n#include \"mbedtls/${include_name}.h\"\n". $headers .= "\n#include \"mbedtls/${include_name}.h\"\n".
"#endif\n\n" if ($include_name ne ""); "#endif\n\n" if ($include_name ne "");
${$old_define_name} = $define_name; ${$old_define_name} = $define_name;