mirror of https://github.com/encounter/SDL.git
Add static assertions for version numbers' limits
Signed-off-by: Simon McVittie <smcv@collabora.com>
This commit is contained in:
parent
ba6f96275e
commit
d4b82bfa4c
16
src/SDL.c
16
src/SDL.c
|
@ -62,6 +62,22 @@ extern int SDL_HelperWindowCreate(void);
|
||||||
extern int SDL_HelperWindowDestroy(void);
|
extern int SDL_HelperWindowDestroy(void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
SDL_COMPILE_TIME_ASSERT(SDL_MAJOR_VERSION_min, SDL_MAJOR_VERSION >= 0);
|
||||||
|
/* Limited only by the need to fit in SDL_version */
|
||||||
|
SDL_COMPILE_TIME_ASSERT(SDL_MAJOR_VERSION_max, SDL_MAJOR_VERSION <= 255);
|
||||||
|
|
||||||
|
SDL_COMPILE_TIME_ASSERT(SDL_MINOR_VERSION_min, SDL_MINOR_VERSION >= 0);
|
||||||
|
/* Limited only by the need to fit in SDL_version */
|
||||||
|
SDL_COMPILE_TIME_ASSERT(SDL_MINOR_VERSION_max, SDL_MINOR_VERSION <= 255);
|
||||||
|
|
||||||
|
SDL_COMPILE_TIME_ASSERT(SDL_PATCHLEVEL_min, SDL_PATCHLEVEL >= 0);
|
||||||
|
#if SDL_MAJOR_VERSION < 3
|
||||||
|
/* Limited by its encoding in SDL_VERSIONNUM */
|
||||||
|
SDL_COMPILE_TIME_ASSERT(SDL_PATCHLEVEL_max, SDL_PATCHLEVEL <= 99);
|
||||||
|
#else
|
||||||
|
/* Limited only by the need to fit in SDL_version */
|
||||||
|
SDL_COMPILE_TIME_ASSERT(SDL_PATCHLEVEL_max, SDL_PATCHLEVEL <= 255);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* This is not declared in any header, although it is shared between some
|
/* This is not declared in any header, although it is shared between some
|
||||||
parts of SDL, because we don't want anything calling it without an
|
parts of SDL, because we don't want anything calling it without an
|
||||||
|
|
Loading…
Reference in New Issue