Add compiler detection macros

This commit is contained in:
Abdelrahman Said 2025-04-20 18:27:57 +01:00
parent 4f9f632362
commit b13274cd81

View File

@ -58,4 +58,40 @@
#error "Unrecognised platform"
#endif
#ifdef __cplusplus
#define WAPP_PLATFORM_CPP
#if __cplusplus == 199711L
#define WAPP_PLATFORM_CPP98
#elif __cplusplus == 201103L
#define WAPP_PLATFORM_CPP11
#elif __cplusplus == 201402L
#define WAPP_PLATFORM_CPP14
#elif __cplusplus == 201703L
#define WAPP_PLATFORM_CPP17
#elif __cplusplus == 202002L
#define WAPP_PLATFORM_CPP20
#elif __cplusplus == 202302L
#define WAPP_PLATFORM_CPP23
#else
#error "Unrecognised C++ version"
#endif
#else
#define WAPP_PLATFORM_C
#if defined(__STDC_VERSION__)
#if __STDC_VERSION__ == 199901L
#define WAPP_PLATFORM_C99
#elif __STDC_VERSION__ == 201112L
#define WAPP_PLATFORM_C11
#elif __STDC_VERSION__ == 201710L
#define WAPP_PLATFORM_C17
#elif __STDC_VERSION__ == 202311L
#define WAPP_PLATFORM_C23
#else
#error "Unrecognised C version"
#endif
#else
#define WAPP_PLATFORM_C89
#endif
#endif // !__cplusplus
#endif // !PLATFORM_H