win: enable anonymous structs for Visual Studio 2015 and later

This commit is contained in:
Recep Aslantas
2020-01-17 23:55:35 +03:00
parent cf8dc82783
commit f8784ffe8a

View File

@@ -18,22 +18,26 @@
* compatible, cglm doesn't use the anonymous structs internally. * compatible, cglm doesn't use the anonymous structs internally.
*/ */
#ifndef CGLM_USE_ANONYMOUS_STRUCT #ifndef CGLM_USE_ANONYMOUS_STRUCT
/* If the user doesn't explicitly specify if they want anonymous structs or /* If the user doesn't explicitly specify if they want anonymous structs or
* not, then we'll try to intuit an appropriate choice. */ * not, then we'll try to intuit an appropriate choice. */
# if defined(CGLM_NO_ANONYMOUS_STRUCT) # if defined(CGLM_NO_ANONYMOUS_STRUCT)
/* The user has defined CGLM_NO_ANONYMOUS_STRUCT. This used to be the /* The user has defined CGLM_NO_ANONYMOUS_STRUCT. This used to be the
* only #define governing the use of anonymous structs, so for backward * only #define governing the use of anonymous structs, so for backward
* compatibility, we still honor that choice and disable them. */ * compatibility, we still honor that choice and disable them. */
# define CGLM_USE_ANONYMOUS_STRUCT 0 # define CGLM_USE_ANONYMOUS_STRUCT 0
# elif __STDC_VERSION__ >= 20112L || defined(_MSVC_VER) # elif __STDC_VERSION__ >= 20112L || defined(_MSVC_VER)
/* We're compiling for C11 or this is the MSVC compiler. In either /* We're compiling for C11 or this is the MSVC compiler. In either
* case, anonymous structs are available, so use them. */ * case, anonymous structs are available, so use them. */
# define CGLM_USE_ANONYMOUS_STRUCT 1 # define CGLM_USE_ANONYMOUS_STRUCT 1
# else # elif defined(_MSC_VER) && (_MSC_VER >= 1900) /* Visual Studio 2015 */
/* Otherwise, we're presumably building for C99 or C89 and can't rely /* We can support anonymous structs
* on anonymous structs being available. Turn them off. */ * since Visual Studio 2015 or 2017 (1910) maybe? */
# define CGLM_USE_ANONYMOUS_STRUCT 0 # define CGLM_USE_ANONYMOUS_STRUCT 1
# endif # else
/* Otherwise, we're presumably building for C99 or C89 and can't rely
* on anonymous structs being available. Turn them off. */
# define CGLM_USE_ANONYMOUS_STRUCT 0
# endif
#endif #endif
typedef union vec2s { typedef union vec2s {