/* http://msdn.microsoft.com/en-us/library/aa235362(VS.60).aspx */ #define DUK_NORETURN(decl) __declspec(noreturn) decl /* XXX: DUK_UNREACHABLE for msvc? */ #undef DUK_USE_BRANCH_HINTS /* XXX: DUK_LIKELY, DUK_UNLIKELY for msvc? */ /* XXX: DUK_NOINLINE, DUK_INLINE, DUK_ALWAYS_INLINE for msvc? */ #if defined(DUK_F_DLL_BUILD) && defined(DUK_F_WINDOWS) #snippet "msvc_visibility.h.in" #endif #if defined(DUK_F_CPP) #define DUK_USE_COMPILER_STRING "msvc++" #else #define DUK_USE_COMPILER_STRING "msvc" #endif #undef DUK_USE_VARIADIC_MACROS #if defined(DUK_F_C99) #define DUK_USE_VARIADIC_MACROS #elif defined(_MSC_VER) && (_MSC_VER >= 1400) /* VS2005+ should have variadic macros even when they're not C99. */ #define DUK_USE_VARIADIC_MACROS #endif #undef DUK_USE_UNION_INITIALIZERS #if defined(_MSC_VER) && (_MSC_VER >= 1800) /* VS2013+ supports union initializers but there's a bug involving union-inside-struct: * https://connect.microsoft.com/VisualStudio/feedback/details/805981 * The bug was fixed (at least) in VS2015 so check for VS2015 for now: * https://blogs.msdn.microsoft.com/vcblog/2015/07/01/c-compiler-front-end-fixes-in-vs2015/ * Manually tested using VS2013, CL reports 18.00.31101, so enable for VS2013 too. */ #define DUK_USE_UNION_INITIALIZERS #endif #undef DUK_USE_FLEX_C99 #undef DUK_USE_FLEX_ZEROSIZE #undef DUK_USE_FLEX_ONESIZE #if defined(DUK_F_C99) #define DUK_USE_FLEX_C99 #else #define DUK_USE_FLEX_ZEROSIZE #endif #undef DUK_USE_GCC_PRAGMAS #define DUK_USE_PACK_MSVC_PRAGMA #if defined(_MSC_VER) && (_MSC_VER >= 1900) #define DUK_SNPRINTF snprintf #define DUK_VSNPRINTF vsnprintf #else /* (v)snprintf() is missing before MSVC 2015. Note that _(v)snprintf() does * NOT NUL terminate on truncation, but Duktape code never assumes that. * http://stackoverflow.com/questions/2915672/snprintf-and-visual-studio-2010 */ #define DUK_SNPRINTF _snprintf #define DUK_VSNPRINTF _vsnprintf #endif