85 lines
2.6 KiB
C
85 lines
2.6 KiB
C
|
/* 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
|
||
|
|
||
|
/* These have been tested from VS2008 onwards; may work in older VS versions
|
||
|
* too but not enabled by default.
|
||
|
*/
|
||
|
#if defined(_MSC_VER) && (_MSC_VER >= 1500)
|
||
|
#define DUK_NOINLINE __declspec(noinline)
|
||
|
#define DUK_INLINE __inline
|
||
|
#define DUK_ALWAYS_INLINE __forceinline
|
||
|
#endif
|
||
|
|
||
|
#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
|
||
|
|
||
|
/* Avoid warning when doing DUK_UNREF(some_function). */
|
||
|
#if defined(_MSC_VER) && (_MSC_VER < 1500)
|
||
|
#pragma warning(disable: 4100 4101 4550 4551)
|
||
|
#define DUK_UNREF(x)
|
||
|
#else
|
||
|
#define DUK_UNREF(x) do { __pragma(warning(suppress:4100 4101 4550 4551)) (x); } while (0)
|
||
|
#endif
|
||
|
|
||
|
/* Older versions of MSVC don't support the LL/ULL suffix. */
|
||
|
#define DUK_U64_CONSTANT(x) x##ui64
|
||
|
#define DUK_I64_CONSTANT(x) x##i64
|