From: slontis Date: Wed, 14 Jan 2026 06:31:41 +0000 (+1100) Subject: Make OpenSSL generated error files use the current clang-format. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=68424f565dcbb2223c832453e15d0119401be868;p=thirdparty%2Fopenssl.git Make OpenSSL generated error files use the current clang-format. Anytime a new error code is added it generates error related files. These are generated using a perl script which used readable indenting. The indenting has been removed. Reviewed-by: Paul Dale Reviewed-by: Richard Levitte (Merged from https://github.com/openssl/openssl/pull/29631) --- diff --git a/util/mkerr.pl b/util/mkerr.pl index 803a3efc83c..b0ba69029a1 100755 --- a/util/mkerr.pl +++ b/util/mkerr.pl @@ -339,21 +339,21 @@ foreach my $lib ( keys %errorfile ) { */ #ifndef $guard -# define $guard -# pragma once +#define $guard +#pragma once -# include -# include +#include +#include -# ifdef __cplusplus +#ifdef __cplusplus extern \"C\" { -# endif +#endif EOF $indent = ' '; if ($disablable) { print OUT <<"EOF"; -# ifndef OPENSSL_NO_${lib} +#ifndef OPENSSL_NO_${lib} EOF $indent = " "; @@ -380,7 +380,7 @@ EOF $rassigned{$lib} .= "$findcode:"; print STDERR "New Reason code $i\n" if $debug; } - printf OUT "#${indent}define $i%s $rcodes{$i}\n", " " x $z; + printf OUT "#define $i $rcodes{$i}\n"; } print OUT "\n"; } @@ -389,14 +389,14 @@ EOF # brace for 'extern "C" {'. while (length($indent) > 1) { $indent = substr $indent, 0, -1; - print OUT "#${indent}endif\n"; + print OUT "#endif\n"; } print OUT <<"EOF"; -# ifdef __cplusplus +#ifdef __cplusplus } -# endif +#endif #endif EOF close OUT; @@ -408,8 +408,8 @@ EOF my $extra_include = $internal ? ($lib ne 'SSL' - ? "# include \n" - : "# include \n") + ? "#include \n" + : "#include \n") : ''; my $hfile = $hpubinc{$lib}; my $guard = $hfile; @@ -430,46 +430,43 @@ EOF */ #ifndef $guard -# define $guard -# pragma once +#define $guard +#pragma once -# include -# include +#include +#include $extra_include - EOF $indent = ' '; if ( $internal ) { if ($disablable) { print OUT <<"EOF"; -# ifndef OPENSSL_NO_${lib} - +#ifndef OPENSSL_NO_${lib} EOF $indent .= ' '; } } else { print OUT <<"EOF"; -# define ${lib}err(f, r) ERR_${lib}_error(0, (r), OPENSSL_FILE, OPENSSL_LINE) -# define ERR_R_${lib}_LIB ERR_${lib}_lib() - +#define ${lib}err(f, r) ERR_${lib}_error(0, (r), OPENSSL_FILE, OPENSSL_LINE) +#define ERR_R_${lib}_LIB ERR_${lib}_lib() EOF if ( ! $static ) { print OUT <<"EOF"; -# ifdef __cplusplus +#ifdef __cplusplus extern \"C\" { -# endif +#endif int ERR_load_${lib}_strings(void); void ERR_unload_${lib}_strings(void); void ERR_${lib}_error(int function, int reason, const char *file, int line); -# ifdef __cplusplus +#ifdef __cplusplus } -# endif +#endif EOF } } - print OUT "\n/*\n * $lib reason codes.\n */\n"; + print OUT "/*\n * $lib reason codes.\n */\n"; foreach my $i ( @reasons ) { my $z = 48 - length($i); $z = 0 if $z < 0; @@ -484,13 +481,13 @@ EOF $rassigned{$lib} .= "$findcode:"; print STDERR "New Reason code $i\n" if $debug; } - printf OUT "#${indent}define $i%s $rcodes{$i}\n", " " x $z; + printf OUT "#define $i $rcodes{$i}\n"; } print OUT "\n"; while (length($indent) > 0) { $indent = substr $indent, 0, -1; - print OUT "#${indent}endif\n"; + print OUT "#endif\n"; } close OUT; } @@ -550,7 +547,7 @@ EOF } } print OUT <<"EOF"; -#${indent}ifndef OPENSSL_NO_ERR +#ifndef OPENSSL_NO_ERR static ${const}ERR_STRING_DATA ${lib}_str_reasons[] = { EOF @@ -568,26 +565,26 @@ EOF $strings{$i} = $rn; } my $lines; - $lines = " {ERR_PACK($pack_lib, 0, $i), \"$rn\"},"; - $lines = " {ERR_PACK($pack_lib, 0, $i),\n \"$rn\"}," - if length($lines) > 80; + $lines = " { ERR_PACK($pack_lib, 0, $i), \"$rn\" },"; + $lines = " { ERR_PACK($pack_lib, 0, $i),\n \"$rn\" }," + if length($lines) > 82; print OUT "$lines\n"; } print OUT <<"EOF"; - {0, NULL} + { 0, NULL } }; -#${indent}endif +#endif EOF if ( $internal ) { print OUT <<"EOF"; int ossl_err_load_${lib}_strings(void) { -#${indent}ifndef OPENSSL_NO_ERR +#ifndef OPENSSL_NO_ERR if (ERR_reason_error_string(${lib}_str_reasons[0].error) == NULL) ERR_load_strings_const(${lib}_str_reasons); -#${indent}endif +#endif return 1; } EOF @@ -642,7 +639,7 @@ EOF while (length($indent) > 1) { $indent = substr $indent, 0, -1; - print OUT "#${indent}endif\n"; + print OUT "#endif\n"; } if ($internal && $disablable) { print OUT <<"EOF";