SDL_platform_defines.h: Added documentation, and a little whitespace.

wikiheaders needs the documentation in the first row of the line, at least
currently, so I've only indented things I could get away with, but it might
be a little easier to follow the preprocessor logic now.
This commit is contained in:
Ryan C. Gordon
2024-09-06 15:09:29 -04:00
parent 4c8357a37d
commit 73b294cb1c
2 changed files with 328 additions and 53 deletions
+4
View File
@@ -64,6 +64,10 @@ Note the `/**` at the start of the comment. That's a "Doxygen-style" comment,
and wikiheaders will treat this differently than a comment with one `*`, as and wikiheaders will treat this differently than a comment with one `*`, as
this signifies that this is not just a comment, but _documentation_. this signifies that this is not just a comment, but _documentation_.
These comments _must_ start in the first column of the line, or wikiheaders
will ignore them, even with the "/**" start (we should improve the script
someday to handle this, but currently this is a requirement).
We do _not_ parse every magic Doxygen tag, and we don't parse them in `@param` We do _not_ parse every magic Doxygen tag, and we don't parse them in `@param`
format. The goal here was to mostly coexist with people that might want format. The goal here was to mostly coexist with people that might want
to run Doxygen on the SDL headers, not to build Doxygen from scratch. That to run Doxygen on the SDL headers, not to build Doxygen from scratch. That
+276 -5
View File
@@ -29,40 +29,129 @@
#define SDL_platform_defines_h_ #define SDL_platform_defines_h_
#ifdef _AIX #ifdef _AIX
/**
* A preprocessor macro that is only defined if compiling for AIX.
*
* \since This macro is available since SDL 3.0.0.
*/
#define SDL_PLATFORM_AIX 1 #define SDL_PLATFORM_AIX 1
#endif #endif
#ifdef __HAIKU__ #ifdef __HAIKU__
/**
* A preprocessor macro that is only defined if compiling for Haiku OS.
*
* \since This macro is available since SDL 3.0.0.
*/
#define SDL_PLATFORM_HAIKU 1 #define SDL_PLATFORM_HAIKU 1
#endif #endif
#if defined(bsdi) || defined(__bsdi) || defined(__bsdi__) #if defined(bsdi) || defined(__bsdi) || defined(__bsdi__)
/**
* A preprocessor macro that is only defined if compiling for BSDi
*
* \since This macro is available since SDL 3.0.0.
*/
#define SDL_PLATFORM_BSDI 1 #define SDL_PLATFORM_BSDI 1
#endif #endif
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
/**
* A preprocessor macro that is only defined if compiling for FreeBSD.
*
* \since This macro is available since SDL 3.0.0.
*/
#define SDL_PLATFORM_FREEBSD 1 #define SDL_PLATFORM_FREEBSD 1
#endif #endif
#if defined(hpux) || defined(__hpux) || defined(__hpux__) #if defined(hpux) || defined(__hpux) || defined(__hpux__)
/**
* A preprocessor macro that is only defined if compiling for HP-UX.
*
* \since This macro is available since SDL 3.0.0.
*/
#define SDL_PLATFORM_HPUX 1 #define SDL_PLATFORM_HPUX 1
#endif #endif
#if defined(sgi) || defined(__sgi) || defined(__sgi__) || defined(_SGI_SOURCE) #if defined(sgi) || defined(__sgi) || defined(__sgi__) || defined(_SGI_SOURCE)
/**
* A preprocessor macro that is only defined if compiling for IRIX.
*
* \since This macro is available since SDL 3.0.0.
*/
#define SDL_PLATFORM_IRIX 1 #define SDL_PLATFORM_IRIX 1
#endif #endif
#if (defined(linux) || defined(__linux) || defined(__linux__)) #if (defined(linux) || defined(__linux) || defined(__linux__))
/**
* A preprocessor macro that is only defined if compiling for Linux.
*
* Note that Android, although ostensibly a Linux-based system, will not
* define this. It defines SDL_PLATFORM_ANDROID instead.
*
* \since This macro is available since SDL 3.0.0.
*/
#define SDL_PLATFORM_LINUX 1 #define SDL_PLATFORM_LINUX 1
#endif #endif
#if defined(ANDROID) || defined(__ANDROID__) #if defined(ANDROID) || defined(__ANDROID__)
#undef SDL_PLATFORM_LINUX /* do we need to do this? */
/**
* A preprocessor macro that is only defined if compiling for Android.
*
* \since This macro is available since SDL 3.0.0.
*/
#define SDL_PLATFORM_ANDROID 1 #define SDL_PLATFORM_ANDROID 1
#undef SDL_PLATFORM_LINUX
#endif #endif
#ifdef __NGAGE__ #ifdef __NGAGE__
/**
* A preprocessor macro that is only defined if compiling for Nokia N-Gage.
*
* \since This macro is available since SDL 3.0.0.
*/
#define SDL_PLATFORM_NGAGE 1 #define SDL_PLATFORM_NGAGE 1
#endif #endif
#if defined(__unix__) || defined(__unix) || defined(unix) #if defined(__unix__) || defined(__unix) || defined(unix)
/**
* A preprocessor macro that is only defined if compiling for a Unix-like
* system.
*
* Other platforms, like Linux, might define this in addition to their primary
* define.
*
* \since This macro is available since SDL 3.0.0.
*/
#define SDL_PLATFORM_UNIX 1 #define SDL_PLATFORM_UNIX 1
#endif #endif
#ifdef __APPLE__ #ifdef __APPLE__
/**
* A preprocessor macro that is only defined if compiling for Apple platforms.
*
* iOS, macOS, etc will additionally define a more specific platform macro.
*
* \since This macro is available since SDL 3.0.0.
*
* \sa SDL_PLATFORM_MACOS
* \sa SDL_PLATFORM_IOS
* \sa SDL_PLATFORM_TVOS
* \sa SDL_PLATFORM_VISIONOS
*/
#define SDL_PLATFORM_APPLE 1 #define SDL_PLATFORM_APPLE 1
/* lets us know what version of macOS we're compiling on */ /* lets us know what version of macOS we're compiling on */
#include <AvailabilityMacros.h> #include <AvailabilityMacros.h>
#ifndef __has_extension /* Older compilers don't support this */ #ifndef __has_extension /* Older compilers don't support this */
@@ -97,52 +186,164 @@
#endif #endif
#if TARGET_OS_TV #if TARGET_OS_TV
/**
* A preprocessor macro that is only defined if compiling for tvOS.
*
* \since This macro is available since SDL 3.0.0.
*
* \sa SDL_PLATFORM_APPLE
*/
#define SDL_PLATFORM_TVOS 1 #define SDL_PLATFORM_TVOS 1
#endif #endif
#if TARGET_OS_VISION #if TARGET_OS_VISION
/**
* A preprocessor macro that is only defined if compiling for VisionOS.
*
* \since This macro is available since SDL 3.0.0.
*
* \sa SDL_PLATFORM_APPLE
*/
#define SDL_PLATFORM_VISIONOS 1 #define SDL_PLATFORM_VISIONOS 1
#endif #endif
#if TARGET_OS_IPHONE #if TARGET_OS_IPHONE
/**
* A preprocessor macro that is only defined if compiling for iOS.
*
* \since This macro is available since SDL 3.0.0.
*
* \sa SDL_PLATFORM_APPLE
*/
#define SDL_PLATFORM_IOS 1 #define SDL_PLATFORM_IOS 1
#else #else
/**
* A preprocessor macro that is only defined if compiling for macOS.
*
* \since This macro is available since SDL 3.0.0.
*
* \sa SDL_PLATFORM_APPLE
*/
#define SDL_PLATFORM_MACOS 1 #define SDL_PLATFORM_MACOS 1
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 #if MAC_OS_X_VERSION_MIN_REQUIRED < 1070
#error SDL for macOS only supports deploying on 10.7 and above. #error SDL for macOS only supports deploying on 10.7 and above.
#endif /* MAC_OS_X_VERSION_MIN_REQUIRED < 1070 */ #endif /* MAC_OS_X_VERSION_MIN_REQUIRED < 1070 */
#endif /* TARGET_OS_IPHONE */ #endif /* TARGET_OS_IPHONE */
#endif /* defined(SDL_PLATFORM_APPLE) */ #endif /* defined(__APPLE__) */
#ifdef __EMSCRIPTEN__ #ifdef __EMSCRIPTEN__
/**
* A preprocessor macro that is only defined if compiling for Emscripten.
*
* \since This macro is available since SDL 3.0.0.
*/
#define SDL_PLATFORM_EMSCRIPTEN 1 #define SDL_PLATFORM_EMSCRIPTEN 1
#endif #endif
#ifdef __NetBSD__ #ifdef __NetBSD__
/**
* A preprocessor macro that is only defined if compiling for NetBSD.
*
* \since This macro is available since SDL 3.0.0.
*/
#define SDL_PLATFORM_NETBSD 1 #define SDL_PLATFORM_NETBSD 1
#endif #endif
#ifdef __OpenBSD__ #ifdef __OpenBSD__
/**
* A preprocessor macro that is only defined if compiling for OpenBSD.
*
* \since This macro is available since SDL 3.0.0.
*/
#define SDL_PLATFORM_OPENBSD 1 #define SDL_PLATFORM_OPENBSD 1
#endif #endif
#if defined(__OS2__) || defined(__EMX__) #if defined(__OS2__) || defined(__EMX__)
/**
* A preprocessor macro that is only defined if compiling for OS/2.
*
* \since This macro is available since SDL 3.0.0.
*/
#define SDL_PLATFORM_OS2 1 #define SDL_PLATFORM_OS2 1
#endif #endif
#if defined(osf) || defined(__osf) || defined(__osf__) || defined(_OSF_SOURCE) #if defined(osf) || defined(__osf) || defined(__osf__) || defined(_OSF_SOURCE)
/**
* A preprocessor macro that is only defined if compiling for Tru64 (OSF/1).
*
* \since This macro is available since SDL 3.0.0.
*/
#define SDL_PLATFORM_OSF 1 #define SDL_PLATFORM_OSF 1
#endif #endif
#ifdef __QNXNTO__ #ifdef __QNXNTO__
/**
* A preprocessor macro that is only defined if compiling for QNX Neutrino.
*
* \since This macro is available since SDL 3.0.0.
*/
#define SDL_PLATFORM_QNXNTO 1 #define SDL_PLATFORM_QNXNTO 1
#endif #endif
#if defined(riscos) || defined(__riscos) || defined(__riscos__) #if defined(riscos) || defined(__riscos) || defined(__riscos__)
/**
* A preprocessor macro that is only defined if compiling for RISC OS.
*
* \since This macro is available since SDL 3.0.0.
*/
#define SDL_PLATFORM_RISCOS 1 #define SDL_PLATFORM_RISCOS 1
#endif #endif
#if defined(__sun) && defined(__SVR4) #if defined(__sun) && defined(__SVR4)
/**
* A preprocessor macro that is only defined if compiling for SunOS/Solaris.
*
* \since This macro is available since SDL 3.0.0.
*/
#define SDL_PLATFORM_SOLARIS 1 #define SDL_PLATFORM_SOLARIS 1
#endif #endif
#if defined(__CYGWIN__) #if defined(__CYGWIN__)
/**
* A preprocessor macro that is only defined if compiling for Cygwin.
*
* \since This macro is available since SDL 3.0.0.
*/
#define SDL_PLATFORM_CYGWIN 1 #define SDL_PLATFORM_CYGWIN 1
#endif #endif
#if defined(_WIN32) || defined(SDL_PLATFORM_CYGWIN) #if defined(_WIN32) || defined(SDL_PLATFORM_CYGWIN)
#define SDL_PLATFORM_WINDOWS 1 /* Win32 api and Windows-based OSs */
/**
* A preprocessor macro that is only defined if compiling for Windows.
*
* This also covers several other platforms, like Microsoft GDK, Xbox, WinRT,
* etc. Each will have their own more-specific platform macros, too.
*
* \since This macro is available since SDL 3.0.0.
*
* \sa SDL_PLATFORM_WIN32
* \sa SDL_PLATFORM_XBOXONE
* \sa SDL_PLATFORM_XBOXSERIES
* \sa SDL_PLATFORM_WINGDK
* \sa SDL_PLATFORM_GDK
*/
#define SDL_PLATFORM_WINDOWS 1
/* Try to find out if we're compiling for WinRT, GDK or non-WinRT/GDK */ /* Try to find out if we're compiling for WinRT, GDK or non-WinRT/GDK */
#if defined(_MSC_VER) && defined(__has_include) #if defined(_MSC_VER) && defined(__has_include)
@@ -174,35 +375,105 @@
#if WINAPI_FAMILY_WINRT #if WINAPI_FAMILY_WINRT
#error Windows RT/UWP is no longer supported in SDL #error Windows RT/UWP is no longer supported in SDL
#elif defined(_GAMING_DESKTOP) /* GDK project configuration always defines _GAMING_XXX */ #elif defined(_GAMING_DESKTOP) /* GDK project configuration always defines _GAMING_XXX */
/**
* A preprocessor macro that is only defined if compiling for Microsoft GDK
* for Windows.
*
* \since This macro is available since SDL 3.0.0.
*/
#define SDL_PLATFORM_WINGDK 1 #define SDL_PLATFORM_WINGDK 1
#elif defined(_GAMING_XBOX_XBOXONE) #elif defined(_GAMING_XBOX_XBOXONE)
/**
* A preprocessor macro that is only defined if compiling for Xbox One.
*
* \since This macro is available since SDL 3.0.0.
*/
#define SDL_PLATFORM_XBOXONE 1 #define SDL_PLATFORM_XBOXONE 1
#elif defined(_GAMING_XBOX_SCARLETT) #elif defined(_GAMING_XBOX_SCARLETT)
/**
* A preprocessor macro that is only defined if compiling for Xbox Series.
*
* \since This macro is available since SDL 3.0.0.
*/
#define SDL_PLATFORM_XBOXSERIES 1 #define SDL_PLATFORM_XBOXSERIES 1
#else #else
/**
* A preprocessor macro that is only defined if compiling for desktop Windows.
*
* Despite the "32", this also covers 64-bit Windows; as an informal
* convention, its system layer tends to still be referred to as "the Win32
* API."
*
* \since This macro is available since SDL 3.0.0.
*/
#define SDL_PLATFORM_WIN32 1 #define SDL_PLATFORM_WIN32 1
#endif #endif
#endif /* defined(WIN32) || defined(_WIN32) || defined(SDL_PLATFORM_CYGWIN) */ #endif /* defined(_WIN32) || defined(SDL_PLATFORM_CYGWIN) */
/* This is to support generic "any GDK" separate from a platform-specific GDK */ /* This is to support generic "any GDK" separate from a platform-specific GDK */
#if defined(SDL_PLATFORM_WINGDK) || defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES) #if defined(SDL_PLATFORM_WINGDK) || defined(SDL_PLATFORM_XBOXONE) || defined(SDL_PLATFORM_XBOXSERIES)
/**
* A preprocessor macro that is only defined if compiling for Microsoft GDK on
* any platform.
*
* \since This macro is available since SDL 3.0.0.
*/
#define SDL_PLATFORM_GDK 1 #define SDL_PLATFORM_GDK 1
#endif #endif
#if defined(__PSP__) || defined(__psp__) #if defined(__PSP__) || defined(__psp__)
/**
* A preprocessor macro that is only defined if compiling for Sony PSP.
*
* \since This macro is available since SDL 3.0.0.
*/
#define SDL_PLATFORM_PSP 1 #define SDL_PLATFORM_PSP 1
#endif #endif
#if defined(__PS2__) || defined(PS2) #if defined(__PS2__) || defined(PS2)
/**
* A preprocessor macro that is only defined if compiling for Sony PlayStation
* 2.
*
* \since This macro is available since SDL 3.0.0.
*/
#define SDL_PLATFORM_PS2 1 #define SDL_PLATFORM_PS2 1
#endif #endif
#if defined(__vita__) || defined(__psp2__) #if defined(__vita__) || defined(__psp2__)
/**
* A preprocessor macro that is only defined if compiling for Sony Vita.
*
* \since This macro is available since SDL 3.0.0.
*/
#define SDL_PLATFORM_VITA 1 #define SDL_PLATFORM_VITA 1
#endif #endif
#ifdef __3DS__ #ifdef __3DS__
#undef __3DS__
/**
* A preprocessor macro that is only defined if compiling for Nintendo 3DS.
*
* \since This macro is available since SDL 3.0.0.
*/
#define SDL_PLATFORM_3DS 1 #define SDL_PLATFORM_3DS 1
#undef __3DS__
#endif #endif
#endif /* SDL_platform_defines_h_ */ #endif /* SDL_platform_defines_h_ */