X-Git-Url: https://git.openssl.org/gitweb/?p=openssl.git;a=blobdiff_plain;f=util%2Fmkerr.pl;h=ebc059ef228382cc1d48e148d0dfdcbf1825d102;hp=0293b0be7d233bd992f5a0d057f92594031fa2ae;hb=525f51f6c98751de4db3b81789044d32e3686cda;hpb=6e781e8e076545b5a15e189bbaccbd7aae60d03b diff --git a/util/mkerr.pl b/util/mkerr.pl index 0293b0be7d..ebc059ef22 100644 --- a/util/mkerr.pl +++ b/util/mkerr.pl @@ -3,9 +3,10 @@ my $config = "crypto/err/openssl.ec"; my $debug = 0; my $rebuild = 0; -my $static = 0; +my $static = 1; my $recurse = 0; my $reindex = 0; +my $dowrite = 0; while (@ARGV) { @@ -25,8 +26,11 @@ while (@ARGV) { } elsif($arg eq "-reindex") { $reindex = 1; shift @ARGV; - } elsif($arg eq "-static") { - $static = 1; + } elsif($arg eq "-nostatic") { + $static = 0; + shift @ARGV; + } elsif($arg eq "-write") { + $dowrite = 1; shift @ARGV; } else { last; @@ -62,7 +66,6 @@ while() } elsif (/^R\s+(\S+)\s+(\S+)/) { $rextra{$1} = $2; $rcodes{$1} = $2; - # Add extra reason with $1, value $2 } } @@ -110,20 +113,24 @@ while (($lib, $hdr) = each %hinc) foreach (split /;/, $def) { s/^[\n\s]*//g; s/[\n\s]*$//g; - next if (/\w+\W+(\w+)\W*\(\s*\)$/s); # K&R C - next if (/\(\*(\w*)\([^\)]+/); - if (/\w+\W+\w+\W*\(.*\)$/s) { + next if(/typedef\W/); + if (/\(\*(\w*)\([^\)]+/) { + my $name = $1; + $name =~ tr/[a-z]/[A-Z]/; + $ftrans{$name} = $1; + } elsif (/\w+\W+(\w+)\W*\(\s*\)$/s){ + # K&R C + next ; + } elsif (/\w+\W+\w+\W*\(.*\)$/s) { while (not /\(\)$/s) { s/[^\(\)]*\)$/\)/s; s/\([^\(\)]*\)\)$/\)/s; } s/\(void\)//; /(\w+)\W*\(\)/s; - next if(/typedef\W/); my $name = $1; $name =~ tr/[a-z]/[A-Z]/; $ftrans{$name} = $1; - } elsif (/\(/ and not (/=/ or /DECLARE_STACK/)) { print STDERR "Header $hdr: cannot parse: $_;\n"; } @@ -210,7 +217,7 @@ foreach $lib (keys %csrc) } else { print STDERR "$lib:\t\t$fnew{$lib} New Functions,"; print STDERR " $rnew{$lib} New Reasons.\n"; - + next unless $dowrite; } # If we get here then we have some new error codes so we @@ -277,8 +284,14 @@ EOF # Rewrite the C source file containing the error details. - $hfile =~ /([^\/]+)$/; - my $hincf = $1; + my $hincf; + if($static) { + $hfile =~ /([^\/]+)$/; + $hincf = ""; + } else { + $hincf = "\"$hfile\""; + } + open (OUT,">$cfile") || die "Can't open $cfile for writing"; @@ -344,7 +357,7 @@ EOF #include #include -#include +#include $hincf /* BEGIN ERROR CODES */ #ifndef NO_ERR @@ -437,7 +450,7 @@ void ERR_load_${lib}_strings(void) #ifdef ${lib}_LIB_NAME ${lib}_lib_name->error = ERR_PACK(${lib}_lib_error_code,0,0); ERR_load_strings(0,${lib}_lib_name); -#endif; +#endif } }