fixes in the headers for use with Microsoft Visual C++

This commit is contained in:
krangelov
2019-02-18 11:39:21 +01:00
parent c32cd7133f
commit 1d1e65185a

View File

@@ -74,6 +74,8 @@
#ifdef GU_ALIGNOF #ifdef GU_ALIGNOF
# define gu_alignof GU_ALIGNOF # define gu_alignof GU_ALIGNOF
#elif defined(_MSC_VER)
# define gu_alignof __alignof
#else #else
# define gu_alignof(t_) \ # define gu_alignof(t_) \
((size_t)(offsetof(struct { char c_; t_ e_; }, e_))) ((size_t)(offsetof(struct { char c_; t_ e_; }, e_)))
@@ -193,9 +195,13 @@ typedef union {
void (*fp)(); void (*fp)();
} GuMaxAlign; } GuMaxAlign;
#if defined(_MSC_VER)
#include <malloc.h>
#define gu_alloca(N) alloca(N)
#else
#define gu_alloca(N) \ #define gu_alloca(N) \
(((union { GuMaxAlign align_; uint8_t buf_[N]; }){{0}}).buf_) (((union { GuMaxAlign align_; uint8_t buf_[N]; }){{0}}).buf_)
#endif
// For Doxygen // For Doxygen
#define GU_PRIVATE /** @private */ #define GU_PRIVATE /** @private */