From f94bc63fdb365ce0c8fda1644e240fba843f46f8 Mon Sep 17 00:00:00 2001 From: Anton Matkin Date: Mon, 7 Jul 2025 14:15:34 +0200 Subject: [PATCH] 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 --- scripts/generate_errors.pl | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/scripts/generate_errors.pl b/scripts/generate_errors.pl index 69126793c5..5e4fe38931 100755 --- a/scripts/generate_errors.pl +++ b/scripts/generate_errors.pl @@ -52,6 +52,10 @@ close(FORMAT_FILE); my @files = glob qq("$crypto_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 @matches; foreach my $file (@files) { @@ -85,7 +89,7 @@ foreach my $file (@files) { $description =~ s/^\s+//; $description =~ s/\n( *\*)? */ /g; $description =~ s/\.?\s+$//; - push @matches, [$name, $value, $description]; + push @matches, [$name, $value, $description, grep(/^.*private\/[^\/]+$/, $file)]; ++$found; } if ($found) { @@ -109,7 +113,7 @@ my %error_codes_seen; 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" if( $error_codes_seen{$error_code}++ ); @@ -203,6 +207,11 @@ foreach my $match (@matches) if ($include_name ne ""); } ${$code_check} .= "\n"; + + if ($is_private_header) { + $include_name = "private/" . $include_name; + } + $headers .= "\n#include \"mbedtls/${include_name}.h\"\n". "#endif\n\n" if ($include_name ne ""); ${$old_define_name} = $define_name;