Skip to content

Commit e03c5e9

Browse files
authored
We should guard the include (simdjson#881)
1 parent 1f79200 commit e03c5e9

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

include/simdjson/common_defs.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,19 @@ constexpr size_t DEFAULT_MAX_DEPTH = 1024;
7777
#define unlikely(x) x
7878
#endif
7979

80-
#include <CppCoreCheck\Warnings.h>
8180
#define SIMDJSON_PUSH_DISABLE_WARNINGS __pragma(warning( push ))
8281
#define SIMDJSON_PUSH_DISABLE_ALL_WARNINGS __pragma(warning( push, 0 ))
8382
#define SIMDJSON_DISABLE_VS_WARNING(WARNING_NUMBER) __pragma(warning( disable : WARNING_NUMBER ))
8483
// Get rid of Intellisense-only warnings (Code Analysis)
84+
// Though __has_include is C++17, it looks like it is supported in Visual Studio 2017 or better.
85+
// We are probably not supporting earlier version of Visual Studio in any case.
86+
#if __has_include(<CppCoreCheck\Warnings.h>)
87+
#include <CppCoreCheck\Warnings.h>
8588
#define SIMDJSON_DISABLE_UNDESIRED_WARNINGS SIMDJSON_DISABLE_VS_WARNING(ALL_CPPCORECHECK_WARNINGS)
89+
#else
90+
#define SIMDJSON_DISABLE_UNDESIRED_WARNINGS
91+
#endif
92+
8693
#define SIMDJSON_DISABLE_DEPRECATED_WARNING SIMDJSON_DISABLE_VS_WARNING(4996)
8794
#define SIMDJSON_POP_DISABLE_WARNINGS __pragma(warning( pop ))
8895

0 commit comments

Comments
 (0)