diff options
author | Jim Huang <jserv@biilabs.io> | 2021-06-24 17:29:06 +0800 |
---|---|---|
committer | Jim Huang <jserv@biilabs.io> | 2021-06-24 17:29:06 +0800 |
commit | 4369fe43239c56ad017911ef1b704b666a3e35e8 (patch) | |
tree | c1356200952fcd111cf3443ef44d789fb8a0fe82 /include/mimalloc-internal.h | |
parent | 076f815cece59e0a0ee08237c8fbba75465452b6 (diff) |
Eliminate preprocessor warnings due to undefined "__GNUC__" with ClangCL
When building some code against mimalloc with C inside Visual Studio
with ClangCL, the compiler complains about __GNUC__ being undefined.
Reported by Mojca Miklavec.
Close #422
Diffstat (limited to 'include/mimalloc-internal.h')
-rw-r--r-- | include/mimalloc-internal.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/include/mimalloc-internal.h b/include/mimalloc-internal.h index 1e1a796..3be872a 100644 --- a/include/mimalloc-internal.h +++ b/include/mimalloc-internal.h @@ -22,7 +22,7 @@ terms of the MIT license. A copy of the license can be found in the file #define mi_decl_noinline __declspec(noinline) #define mi_decl_thread __declspec(thread) #define mi_decl_cache_align __declspec(align(MI_CACHE_LINE)) -#elif (defined(__GNUC__) && (__GNUC__>=3)) // includes clang and icc +#elif (defined(__GNUC__) && (__GNUC__ >= 3)) || defined(__clang__) // includes clang and icc #define mi_decl_noinline __attribute__((noinline)) #define mi_decl_thread __thread #define mi_decl_cache_align __attribute__((aligned(MI_CACHE_LINE))) @@ -236,7 +236,7 @@ static inline bool mi_malloc_satisfies_alignment(size_t alignment, size_t size) } // Overflow detecting multiply -#if __has_builtin(__builtin_umul_overflow) || __GNUC__ >= 5 +#if __has_builtin(__builtin_umul_overflow) || (defined(__GNUC__) && (__GNUC__ >= 5)) #include <limits.h> // UINT_MAX, ULONG_MAX #if defined(_CLOCK_T) // for Illumos #undef _CLOCK_T @@ -903,7 +903,7 @@ static inline void _mi_memcpy(void* dst, const void* src, size_t n) { // This is used for example in `mi_realloc`. // ------------------------------------------------------------------------------- -#if (__GNUC__ >= 4) || defined(__clang__) +#if (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__) // On GCC/CLang we provide a hint that the pointers are word aligned. #include <string.h> static inline void _mi_memcpy_aligned(void* dst, const void* src, size_t n) { |