SDL: Deprecate SDL_COMPILEDVERSION and SDL_VERSIONNUM, to be removed in 3.x

From e0daa2a53017feca8d7a5739da57445c183428ec Mon Sep 17 00:00:00 2001
From: Simon McVittie <[EMAIL REDACTED]>
Date: Tue, 3 May 2022 13:08:38 +0100
Subject: [PATCH] Deprecate SDL_COMPILEDVERSION and SDL_VERSIONNUM, to be
 removed in 3.x

The encoding used in SDL_VERSIONNUM (e.g. 2.0.22 -> 2022) cannot
represent 2-digit minor versions without overflowing from the hundreds
digit into the thousands digit, which produces confusing version
numbers that will compare incorrectly when the major version is increased
to 3.

However, we can sidestep this problem by declaring that SDL_VERSIONNUM
will no longer be present in SDL 3, which means it only needs to be able
to represent SDL 2 version numbers losslessly.

Signed-off-by: Simon McVittie <smcv@collabora.com>
---
 include/SDL_version.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/include/SDL_version.h b/include/SDL_version.h
index 5bdff3b8412..d6a7a38ed11 100644
--- a/include/SDL_version.h
+++ b/include/SDL_version.h
@@ -83,6 +83,8 @@ typedef struct SDL_version
     (x)->patch = SDL_PATCHLEVEL;                    \
 }
 
+/* TODO: Remove this whole block in SDL 3 */
+#if SDL_MAJOR_VERSION < 3
 /**
  *  This macro turns the version numbers into a numeric value:
  *  \verbatim
@@ -90,15 +92,21 @@ typedef struct SDL_version
     \endverbatim
  *
  *  This assumes that there will never be more than 100 patchlevels.
+ *  This macro will not be available in SDL 3.x.
  */
 #define SDL_VERSIONNUM(X, Y, Z)                     \
     ((X)*1000 + (Y)*100 + (Z))
 
 /**
  *  This is the version number macro for the current SDL version.
+ *
+ *  This macro will not be available in SDL 3.x.
+ *
+ *  Deprecated, use SDL_VERSION_ATLEAST or SDL_VERSION instead.
  */
 #define SDL_COMPILEDVERSION \
     SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL)
+#endif /* SDL_MAJOR_VERSION < 3 */
 
 /**
  *  This macro will evaluate to true if compiled with SDL at least X.Y.Z.