Add definitions of OSSL_DEPRECATED[_FOR] for Microsoft VC
authorRichard Levitte <levitte@openssl.org>
Sat, 3 Oct 2020 07:45:24 +0000 (09:45 +0200)
committerRichard Levitte <levitte@openssl.org>
Mon, 12 Oct 2020 06:29:30 +0000 (08:29 +0200)
It turns out that they have __declspec(deprecated) that correspond
pretty much to GCC's __attribute__((deprecated)), including for
messages.

Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/13074)

include/openssl/macros.h

index bdeb2793bbc00c5846fb081baed42611ab077564..02a68b2661999ee94dc1d7aa9d96f46b0f3144b4 100644 (file)
 # ifndef OSSL_DEPRECATED
 #  undef OSSL_DEPRECATED_FOR
 #  ifndef OPENSSL_SUPPRESS_DEPRECATED
-#   if defined(__GNUC__)
+#   if defined(_MSC_VER)
+     /*
+      * MSVC supports __declspec(deprecated) since MSVC 2003 (13.10),
+      * and __declspec(deprecated(message)) since MSVC 2005 (14.00)
+      */
+#    if _MSC_VER >= 1400
+#     define OSSL_DEPRECATED(since) \
+          __declspec(deprecated("Since OpenSSL " # since))
+#     define OSSL_DEPRECATED_FOR(since, message) \
+          __declspec(deprecated("Since OpenSSL " # since ";" message))
+#    elif _MSC_VER >= 1310
+#     define OSSL_DEPRECATED(since) __declspec(deprecated)
+#     define OSSL_DEPRECATED_FOR(since, message) __declspec(deprecated)
+#    endif
+#   elif defined(__GNUC__)
      /*
       * According to GCC documentation, deprecations with message appeared in
       * GCC 4.5.0