use correct macro definitions for clang-cl
clang-cl, an MSVC-compatible frontend built on top of clang, defined _MSC_VER *and* supports __attribute__ syntax. The ordering of the checks in jemalloc_macros.h.in, however, do the wrong thing for clang-cl, as we want the Windows-specific macro definitions for clang-cl. To support this use case, we reorder the checks so that _MSC_VER is checked first (which includes clang-cl), and then JEMALLOC_HAVE_ATTR) is checked. No functionality change intended.
This commit is contained in:
parent
606ae49fa3
commit
566d4c0240
@ -36,32 +36,7 @@
|
|||||||
# define JEMALLOC_CXX_THROW
|
# define JEMALLOC_CXX_THROW
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef JEMALLOC_HAVE_ATTR
|
#if _MSC_VER
|
||||||
# define JEMALLOC_ATTR(s) __attribute__((s))
|
|
||||||
# define JEMALLOC_ALIGNED(s) JEMALLOC_ATTR(aligned(s))
|
|
||||||
# ifdef JEMALLOC_HAVE_ATTR_ALLOC_SIZE
|
|
||||||
# define JEMALLOC_ALLOC_SIZE(s) JEMALLOC_ATTR(alloc_size(s))
|
|
||||||
# define JEMALLOC_ALLOC_SIZE2(s1, s2) JEMALLOC_ATTR(alloc_size(s1, s2))
|
|
||||||
# else
|
|
||||||
# define JEMALLOC_ALLOC_SIZE(s)
|
|
||||||
# define JEMALLOC_ALLOC_SIZE2(s1, s2)
|
|
||||||
# endif
|
|
||||||
# ifndef JEMALLOC_EXPORT
|
|
||||||
# define JEMALLOC_EXPORT JEMALLOC_ATTR(visibility("default"))
|
|
||||||
# endif
|
|
||||||
# ifdef JEMALLOC_HAVE_ATTR_FORMAT_GNU_PRINTF
|
|
||||||
# define JEMALLOC_FORMAT_PRINTF(s, i) JEMALLOC_ATTR(format(gnu_printf, s, i))
|
|
||||||
# elif defined(JEMALLOC_HAVE_ATTR_FORMAT_PRINTF)
|
|
||||||
# define JEMALLOC_FORMAT_PRINTF(s, i) JEMALLOC_ATTR(format(printf, s, i))
|
|
||||||
# else
|
|
||||||
# define JEMALLOC_FORMAT_PRINTF(s, i)
|
|
||||||
# endif
|
|
||||||
# define JEMALLOC_NOINLINE JEMALLOC_ATTR(noinline)
|
|
||||||
# define JEMALLOC_NOTHROW JEMALLOC_ATTR(nothrow)
|
|
||||||
# define JEMALLOC_SECTION(s) JEMALLOC_ATTR(section(s))
|
|
||||||
# define JEMALLOC_RESTRICT_RETURN
|
|
||||||
# define JEMALLOC_ALLOCATOR
|
|
||||||
#elif _MSC_VER
|
|
||||||
# define JEMALLOC_ATTR(s)
|
# define JEMALLOC_ATTR(s)
|
||||||
# define JEMALLOC_ALIGNED(s) __declspec(align(s))
|
# define JEMALLOC_ALIGNED(s) __declspec(align(s))
|
||||||
# define JEMALLOC_ALLOC_SIZE(s)
|
# define JEMALLOC_ALLOC_SIZE(s)
|
||||||
@ -87,6 +62,31 @@
|
|||||||
# else
|
# else
|
||||||
# define JEMALLOC_ALLOCATOR
|
# define JEMALLOC_ALLOCATOR
|
||||||
# endif
|
# endif
|
||||||
|
#elif defined(JEMALLOC_HAVE_ATTR)
|
||||||
|
# define JEMALLOC_ATTR(s) __attribute__((s))
|
||||||
|
# define JEMALLOC_ALIGNED(s) JEMALLOC_ATTR(aligned(s))
|
||||||
|
# ifdef JEMALLOC_HAVE_ATTR_ALLOC_SIZE
|
||||||
|
# define JEMALLOC_ALLOC_SIZE(s) JEMALLOC_ATTR(alloc_size(s))
|
||||||
|
# define JEMALLOC_ALLOC_SIZE2(s1, s2) JEMALLOC_ATTR(alloc_size(s1, s2))
|
||||||
|
# else
|
||||||
|
# define JEMALLOC_ALLOC_SIZE(s)
|
||||||
|
# define JEMALLOC_ALLOC_SIZE2(s1, s2)
|
||||||
|
# endif
|
||||||
|
# ifndef JEMALLOC_EXPORT
|
||||||
|
# define JEMALLOC_EXPORT JEMALLOC_ATTR(visibility("default"))
|
||||||
|
# endif
|
||||||
|
# ifdef JEMALLOC_HAVE_ATTR_FORMAT_GNU_PRINTF
|
||||||
|
# define JEMALLOC_FORMAT_PRINTF(s, i) JEMALLOC_ATTR(format(gnu_printf, s, i))
|
||||||
|
# elif defined(JEMALLOC_HAVE_ATTR_FORMAT_PRINTF)
|
||||||
|
# define JEMALLOC_FORMAT_PRINTF(s, i) JEMALLOC_ATTR(format(printf, s, i))
|
||||||
|
# else
|
||||||
|
# define JEMALLOC_FORMAT_PRINTF(s, i)
|
||||||
|
# endif
|
||||||
|
# define JEMALLOC_NOINLINE JEMALLOC_ATTR(noinline)
|
||||||
|
# define JEMALLOC_NOTHROW JEMALLOC_ATTR(nothrow)
|
||||||
|
# define JEMALLOC_SECTION(s) JEMALLOC_ATTR(section(s))
|
||||||
|
# define JEMALLOC_RESTRICT_RETURN
|
||||||
|
# define JEMALLOC_ALLOCATOR
|
||||||
#else
|
#else
|
||||||
# define JEMALLOC_ATTR(s)
|
# define JEMALLOC_ATTR(s)
|
||||||
# define JEMALLOC_ALIGNED(s)
|
# define JEMALLOC_ALIGNED(s)
|
||||||
|
Loading…
Reference in New Issue
Block a user