Improves clang-cl build with Visual Studio (#809)

This commit is contained in:
PavelP 2020-04-27 18:59:32 +06:00 committed by GitHub
parent 59d1212039
commit 0514588175
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 30 additions and 3 deletions

View File

@ -8,6 +8,12 @@
*/ */
#include "simdjson/compiler_check.h" #include "simdjson/compiler_check.h"
#include "simdjson/common_defs.h"
SIMDJSON_PUSH_DISABLE_WARNINGS
#if defined(_MSC_VER) && defined(__clang__)
SIMDJSON_DISABLE_GCC_WARNING(-Wmicrosoft-include)
#endif
// Public API // Public API
#include "simdjson/simdjson_version.h" #include "simdjson/simdjson_version.h"
@ -29,4 +35,6 @@
#include "simdjson/inline/padded_string.h" #include "simdjson/inline/padded_string.h"
#include "simdjson/inline/parsedjson_iterator.h" #include "simdjson/inline/parsedjson_iterator.h"
SIMDJSON_POP_DISABLE_WARNINGS
#endif // SIMDJSON_H #endif // SIMDJSON_H

View File

@ -59,7 +59,7 @@ constexpr size_t DEFAULT_MAX_DEPTH = 1024;
#define ISALIGNED_N(ptr, n) (((uintptr_t)(ptr) & ((n)-1)) == 0) #define ISALIGNED_N(ptr, n) (((uintptr_t)(ptr) & ((n)-1)) == 0)
#ifdef _MSC_VER #if defined(_MSC_VER) && !defined(__clang__)
#define really_inline __forceinline #define really_inline __forceinline
#define never_inline __declspec(noinline) #define never_inline __declspec(noinline)
@ -119,7 +119,15 @@ constexpr size_t DEFAULT_MAX_DEPTH = 1024;
#define SIMDJSON_DISABLE_DEPRECATED_WARNING SIMDJSON_DISABLE_GCC_WARNING(-Wdeprecated-declarations) #define SIMDJSON_DISABLE_DEPRECATED_WARNING SIMDJSON_DISABLE_GCC_WARNING(-Wdeprecated-declarations)
#define SIMDJSON_POP_DISABLE_WARNINGS _Pragma("GCC diagnostic pop") #define SIMDJSON_POP_DISABLE_WARNINGS _Pragma("GCC diagnostic pop")
#if defined(_MSC_VER) && defined(__clang__)
#if SIMDJSON_USING_LIBRARY
#define SIMDJSON_DLLIMPORTEXPORT __declspec(dllimport)
#else
#define SIMDJSON_DLLIMPORTEXPORT __declspec(dllexport)
#endif
#else
#define SIMDJSON_DLLIMPORTEXPORT #define SIMDJSON_DLLIMPORTEXPORT
#endif
#endif // MSC_VER #endif // MSC_VER

View File

@ -4,7 +4,14 @@
#include "simdjson.h" #include "simdjson.h"
#ifdef _MSC_VER #ifdef _MSC_VER
#include <intrin.h> // visual studio // visual studio (or clang-cl)
#include <intrin.h>
#ifdef __clang__
#include <bmiintrin.h>
#include <lzcntintrin.h>
#include <immintrin.h>
#include <wmmintrin.h>
#endif
#else #else
#include <x86intrin.h> // elsewhere #include <x86intrin.h> // elsewhere
#endif // _MSC_VER #endif // _MSC_VER

View File

@ -1,5 +1,9 @@
#include "simdjson.h" #include "simdjson.h"
#if defined(_MSC_VER) && defined(__clang__)
SIMDJSON_DISABLE_GCC_WARNING(-Wmicrosoft-include)
#endif
/* used for http://dmalloc.com/ Dmalloc - Debug Malloc Library */ /* used for http://dmalloc.com/ Dmalloc - Debug Malloc Library */
#ifdef DMALLOC #ifdef DMALLOC
#include "dmalloc.h" #include "dmalloc.h"