summaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2020-10-04 11:51:20 +0200
committerRichard Levitte <levitte@openssl.org>2020-10-12 08:29:30 +0200
commit053730c5b7e9f4d0e97108e01d0fce472f300edd (patch)
treeb48df4199e448f6261f8a84528981f62c0d6811e /util
parent77c30753cdcf4da182953b3b169296c6612089ef (diff)
Make OpenSSL::ParseC and OpenSSL::Ordinals treat deprecation consistently
The triggering macro that decides if a symbol is to be considered deprecated is OPENSSL_NO_DEPRECATEDIN_x_y[_z]. OpenSSL::ParseC renames any OPENSSL_NO_DEPRECATED_x_y[_z] by inserting "IN". Reviewed-by: Paul Dale <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/13074)
Diffstat (limited to 'util')
-rw-r--r--util/perl/OpenSSL/Ordinals.pm1
-rw-r--r--util/perl/OpenSSL/ParseC.pm17
2 files changed, 13 insertions, 5 deletions
diff --git a/util/perl/OpenSSL/Ordinals.pm b/util/perl/OpenSSL/Ordinals.pm
index 7008ebf536..8f113fb8f6 100644
--- a/util/perl/OpenSSL/Ordinals.pm
+++ b/util/perl/OpenSSL/Ordinals.pm
@@ -407,7 +407,6 @@ sub _parse_features {
if ($def =~ m{^ZLIB$}) { $features{$&} = $op; }
if ($def =~ m{^OPENSSL_USE_}) { $features{$'} = $op; }
if ($def =~ m{^OPENSSL_NO_}) { $features{$'} = !$op; }
- if ($def =~ m{^DEPRECATEDIN_(.*)$}) { $features{$&} = !$op; }
}
return %features;
diff --git a/util/perl/OpenSSL/ParseC.pm b/util/perl/OpenSSL/ParseC.pm
index 7e6377dd17..d7e7c40f1f 100644
--- a/util/perl/OpenSSL/ParseC.pm
+++ b/util/perl/OpenSSL/ParseC.pm
@@ -75,7 +75,7 @@ my @opensslcpphandlers = (
#if$1 OPENSSL_NO_DEPRECATEDIN_$2
EOF
}
- }
+ }
);
my @cpphandlers = (
##################################################################
@@ -262,17 +262,26 @@ my @opensslchandlers = (
# Deprecated stuff, by OpenSSL release.
# We trick the parser by pretending that the declaration is wrapped in a
- # check if the DEPRECATEDIN macro is defined or not. Callers of parse()
- # will have to decide what to do with it.
+ # check if the OPENSSL_NO_DEPRECATEDIN_x_y[_z] macro is defined or not.
+ # Callers of parse() will have to decide what to do with it.
{ regexp => qr/(DEPRECATEDIN_\d+_\d+(?:_\d+)?)<<<\((.*)\)>>>/,
massager => sub { return (<<"EOF");
-#ifndef $1
+#ifndef OPENSSL_NO_$1
$2;
#endif
EOF
},
},
+ # OSSL_DEPRECATEDIN_x_y[_z] is simply ignored. Such declarations are
+ # supposed to be guarded with an '#ifdef OPENSSL_NO_DEPRECATED_x_y[_z]'
+ { regexp => qr/OSSL_DEPRECATEDIN_\d+_\d+(?:_\d+)?\s+(.*)/,
+ massager => sub { return $1; },
+ },
+ { regexp => qr/(.*?)\s+OSSL_DEPRECATEDIN_\d+_\d+(?:_\d+)?\s+(.*)/,
+ massager => sub { return "$1 $2"; },
+ },
+
#####
# LHASH stuff