Commit 420fd332d3 for openssl.org
commit 420fd332d3ae72b98016271ea1cd030055f772a3
Author: Pauli <paul.dale@oracle.com>
Date: Tue Jul 21 12:54:28 2026 +1000
param parsing: cleaned generated file includes, flagged things as unused
Cleaned up the generated files so that they only #include dependencies once
rather than once per generated parser.
Flagged the generated OSSL_PARAM list and parsing function with ossl_unused
so that they won't generate warnings if compilation unit doesn't use them.
This is necessary if the generated parser is included from different files.
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Mounir Idrassi <mounir.idrassi@idrix.fr>
(Merged from https://github.com/openssl/openssl/pull/32502)
diff --git a/util/perl/OpenSSL/paramnames.pm b/util/perl/OpenSSL/paramnames.pm
index 328189c7b3..23dd031665 100644
--- a/util/perl/OpenSSL/paramnames.pm
+++ b/util/perl/OpenSSL/paramnames.pm
@@ -17,6 +17,7 @@ our @EXPORT_OK = qw(generate_public_macros
produce_param_decoder
produce_param_decoder_with_count);
+our $headers_included = 0;
my $case_sensitive = 1;
my $need_break = 0;
my $invalid_param = "invalid param";
@@ -864,16 +865,21 @@ sub output_param_decoder {
my %concat_num = ();
my %ifdefs = ();
- print "/* Machine generated by util/perl/OpenSSL/paramnames.pm */\n";
- # IWYU
- print "#include <string.h>\n";
- print "#include <openssl/params.h>\n";
- print "#include \"internal/common.h\"\n";
- print "#include \"prov/proverr.h\"\n";
- print "\n";
+ if (!$headers_included) {
+ $headers_included = 1;
+ print "/* Machine generated by util/perl/OpenSSL/paramnames.pm */\n";
+ # IWYU
+ print "#include <string.h>\n";
+ print "#include <openssl/params.h>\n";
+ print "#include <openssl/e_os2.h>\n";
+ print "#include \"internal/common.h\"\n";
+ print "#include \"prov/proverr.h\"\n";
+ print "\n";
+ }
+ print "/* Machine generated */\n";
# Output gettable param array
printf "#ifndef %s_list\n", $decoder_name_base;
- printf "static const OSSL_PARAM %s_list[] = {\n", $decoder_name_base;
+ printf "static ossl_unused const OSSL_PARAM %s_list[] = {\n", $decoder_name_base;
for (my $i = 0; $i <= $#params; $i++) {
my $pname = $params[$i][0];
my $pident = $params[$i][1];
@@ -944,7 +950,7 @@ sub output_param_decoder {
locate_long_endings(\%t);
printf "#ifndef %s_decoder\n", $decoder_name_base;
- printf "static int %s_decoder\n", $decoder_name_base;
+ printf "static ossl_unused int %s_decoder\n", $decoder_name_base;
printf " (const OSSL_PARAM *p, struct %s_st *r", $decoder_name_base;
printf "%s)\n", ($with_count ? ", int *count" : "");
print "{\n";