mirror of https://github.com/svaarala/duktape.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
84 lines
2.4 KiB
84 lines
2.4 KiB
#if defined(DUK_F_C99) || defined(DUK_F_CPP11)
|
|
/* C99 / C++11 and above: rely on va_copy() which is required. */
|
|
#define DUK_VA_COPY(dest,src) va_copy(dest,src)
|
|
#else
|
|
/* GCC: assume we have __va_copy() in non-C99 mode. */
|
|
#define DUK_VA_COPY(dest,src) __va_copy(dest,src)
|
|
#endif
|
|
|
|
#if defined(DUK_F_GCC_VERSION) && (DUK_F_GCC_VERSION >= 20500L)
|
|
/* since gcc-2.5 */
|
|
#define DUK_NORETURN(decl) decl __attribute__((noreturn))
|
|
#endif
|
|
|
|
#if defined(DUK_F_GCC_VERSION) && (DUK_F_GCC_VERSION >= 40500L)
|
|
/* since gcc-4.5 */
|
|
#define DUK_UNREACHABLE() do { __builtin_unreachable(); } while (0)
|
|
#endif
|
|
|
|
#define DUK_USE_BRANCH_HINTS
|
|
#if defined(DUK_F_GCC_VERSION) && (DUK_F_GCC_VERSION >= 40500L)
|
|
/* GCC: test not very accurate; enable only in relatively recent builds
|
|
* because of bugs in gcc-4.4 (http://lists.debian.org/debian-gcc/2010/04/msg00000.html)
|
|
*/
|
|
#define DUK_LIKELY(x) __builtin_expect((x), 1)
|
|
#define DUK_UNLIKELY(x) __builtin_expect((x), 0)
|
|
#endif
|
|
/* XXX: equivalent of clang __builtin_unpredictable? */
|
|
|
|
#if (defined(DUK_F_C99) || defined(DUK_F_CPP11)) && \
|
|
defined(DUK_F_GCC_VERSION) && (DUK_F_GCC_VERSION >= 30101)
|
|
#define DUK_NOINLINE __attribute__((noinline))
|
|
#define DUK_INLINE inline
|
|
#define DUK_ALWAYS_INLINE inline __attribute__((always_inline))
|
|
#endif
|
|
|
|
#if (defined(DUK_F_C99) || defined(DUK_F_CPP11)) && \
|
|
defined(DUK_F_GCC_VERSION) && (DUK_F_GCC_VERSION >= 40300)
|
|
#define DUK_HOT __attribute__((hot))
|
|
#define DUK_COLD __attribute__((cold))
|
|
#endif
|
|
|
|
#if defined(DUK_F_DLL_BUILD) && defined(DUK_F_WINDOWS)
|
|
#snippet "msvc_visibility.h.in"
|
|
#elif defined(DUK_F_GCC_VERSION) && (DUK_F_GCC_VERSION >= 40000)
|
|
#snippet "gcc_clang_visibility.h.in"
|
|
#endif
|
|
|
|
#if defined(DUK_F_MINGW)
|
|
#if defined(DUK_F_CPP)
|
|
#define DUK_USE_COMPILER_STRING "mingw++"
|
|
#else
|
|
#define DUK_USE_COMPILER_STRING "mingw"
|
|
#endif
|
|
#else
|
|
#if defined(DUK_F_CPP)
|
|
#define DUK_USE_COMPILER_STRING "g++"
|
|
#else
|
|
#define DUK_USE_COMPILER_STRING "gcc"
|
|
#endif
|
|
#endif
|
|
|
|
#undef DUK_USE_VARIADIC_MACROS
|
|
#if defined(DUK_F_C99) || (defined(DUK_F_CPP11) && defined(__GNUC__))
|
|
#define DUK_USE_VARIADIC_MACROS
|
|
#endif
|
|
|
|
#define DUK_USE_UNION_INITIALIZERS
|
|
|
|
#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
|
|
|
|
#if defined(DUK_F_GCC_VERSION) && (DUK_F_GCC_VERSION >= 40600)
|
|
#define DUK_USE_GCC_PRAGMAS
|
|
#else
|
|
#undef DUK_USE_GCC_PRAGMAS
|
|
#endif
|
|
|
|
#define DUK_USE_PACK_GCC_ATTR
|
|
|