util/mkdef.pl: prepare for DEPRECATEDIN_X
authorRichard Levitte <levitte@openssl.org>
Thu, 27 Sep 2018 13:29:29 +0000 (15:29 +0200)
committerRichard Levitte <levitte@openssl.org>
Thu, 6 Dec 2018 11:24:47 +0000 (12:24 +0100)
This is in preparation for new versioning scheme, where the
recommendation is to start deprecations at major version boundary.

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7724)

util/mkdef.pl
util/perl/OpenSSL/ParseC.pm

index b40fd2654f7d120b35e6cdd90f98c399d39240a2..9cb1147d289871653573301954fc2f4e8040e3c2 100755 (executable)
@@ -193,8 +193,8 @@ sub feature_filter {
 
     if ($apiv) {
         foreach (@features) {
-            next unless /^DEPRECATEDIN_(\d+)_(\d+)_(\d+)$/;
-            my $symdep = sprintf "%x%02x%02x", $1, $2, $3;
+            next unless /^DEPRECATEDIN_(\d+)(?:_(\d+)_(\d+))?$/;
+            my $symdep = sprintf "%x%02x%02x", $1, ($2 // 0), ($3 // 0);
             $verdict = 0 if $apiv ge $symdep;
         }
     }
index ba2427ccfa51ff3f05ccc1006d49d0b080db30ed..81472ef5ebc771aeeeb51b93887b4dd5ff7948c9 100644 (file)
@@ -72,11 +72,14 @@ my @opensslcpphandlers = (
           if ($op ne '<' && $op ne '>=') {
               die "Error: unacceptable operator $op: $_[0]\n";
           }
-          my ($one, $major, $minor) =
+          my ($major, $minor, $edit) =
               ( ($v >> 28) & 0xf,
                 ($v >> 20) & 0xff,
                 ($v >> 12) & 0xff );
-          my $t = "DEPRECATEDIN_${one}_${major}_${minor}";
+          my $t = "DEPRECATEDIN_" .
+              ($major <= 1
+               ? "${major}_${minor}_${edit}"
+               : "${major}");
           my $cond = $op eq '<' ? 'ifndef' : 'ifdef';
           return (<<"EOF");
 #$cond $t
@@ -284,7 +287,7 @@ EOF
     # 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.
-    { regexp   => qr/(DEPRECATEDIN_\d+_\d+_\d+)<<<\((.*)\)>>>/,
+    { regexp   => qr/(DEPRECATEDIN_\d+(?:_\d+_\d+)?)<<<\((.*)\)>>>/,
       massager => sub { return (<<"EOF");
 #ifndef $1
 $2;