|
1 | | -/* auto-generated on Sun 28 Jun 2020 12:39:28 EDT. Do not edit! */ |
| 1 | +/* auto-generated on Sun 28 Jun 2020 20:08:45 EDT. Do not edit! */ |
2 | 2 | /* begin file include/simdjson.h */ |
3 | 3 | #ifndef SIMDJSON_H |
4 | 4 | #define SIMDJSON_H |
|
59 | 59 | #include <cstdint> |
60 | 60 | #include <cstdlib> |
61 | 61 | #include <cfloat> |
62 | | - |
| 62 | +#include <cassert> |
63 | 63 |
|
64 | 64 | #ifdef _MSC_VER |
65 | 65 | #define SIMDJSON_VISUAL_STUDIO 1 |
@@ -286,7 +286,6 @@ static inline void aligned_free_char(char *mem_block) { |
286 | 286 |
|
287 | 287 | #else // NDEBUG |
288 | 288 |
|
289 | | -#include <cassert> |
290 | 289 | #define SIMDJSON_UNREACHABLE() assert(0); |
291 | 290 | #define SIMDJSON_ASSUME(COND) assert(COND) |
292 | 291 |
|
@@ -373,12 +372,15 @@ constexpr size_t DEFAULT_MAX_DEPTH = 1024; |
373 | 372 | #define SIMDJSON_PUSH_DISABLE_ALL_WARNINGS __pragma(warning( push, 0 )) |
374 | 373 | #define SIMDJSON_DISABLE_VS_WARNING(WARNING_NUMBER) __pragma(warning( disable : WARNING_NUMBER )) |
375 | 374 | // Get rid of Intellisense-only warnings (Code Analysis) |
376 | | - // Though __has_include is C++17, it looks like it is supported in Visual Studio 2017 or better. |
377 | | - // We are probably not supporting earlier version of Visual Studio in any case. |
| 375 | + // Though __has_include is C++17, it is supported in Visual Studio 2017 or better (_MSC_VER>=1910). |
| 376 | + #if defined(_MSC_VER) && (_MSC_VER>=1910) |
378 | 377 | #if __has_include(<CppCoreCheck\Warnings.h>) |
379 | 378 | #include <CppCoreCheck\Warnings.h> |
380 | 379 | #define SIMDJSON_DISABLE_UNDESIRED_WARNINGS SIMDJSON_DISABLE_VS_WARNING(ALL_CPPCORECHECK_WARNINGS) |
381 | | - #else |
| 380 | + #endif |
| 381 | + #endif |
| 382 | +
|
| 383 | + #ifndef SIMDJSON_DISABLE_UNDESIRED_WARNINGS |
382 | 384 | #define SIMDJSON_DISABLE_UNDESIRED_WARNINGS |
383 | 385 | #endif |
384 | 386 |
|
@@ -3673,7 +3675,12 @@ class parser { |
3673 | 3675 | /** |
3674 | 3676 | * The loaded buffer (reused each time load() is called) |
3675 | 3677 | */ |
| 3678 | + #if defined(_MSC_VER) && _MSC_VER < 1910 |
| 3679 | + // older versions of Visual Studio lack proper support for unique_ptr. |
| 3680 | + std::unique_ptr<char[]> loaded_bytes; |
| 3681 | + #else |
3676 | 3682 | std::unique_ptr<char[], decltype(&aligned_free_char)> loaded_bytes; |
| 3683 | + #endif |
3677 | 3684 |
|
3678 | 3685 | /** Capacity of loaded_bytes buffer. */ |
3679 | 3686 | size_t _loaded_bytes_capacity{0}; |
@@ -6779,7 +6786,12 @@ inline char *allocate_padded_buffer(size_t length) noexcept { |
6779 | 6786 | // return (char *) malloc(length + SIMDJSON_PADDING); |
6780 | 6787 | // However, we might as well align to cache lines... |
6781 | 6788 | size_t totalpaddedlength = length + SIMDJSON_PADDING; |
| 6789 | +#if defined(_MSC_VER) && _MSC_VER < 1910 |
| 6790 | + // For legacy Visual Studio 2015 since it does not have proper C++11 support |
| 6791 | + char *padded_buffer = new[totalpaddedlength]; |
| 6792 | +#else |
6782 | 6793 | char *padded_buffer = aligned_malloc_char(64, totalpaddedlength); |
| 6794 | +#endif |
6783 | 6795 | #ifndef NDEBUG |
6784 | 6796 | if (padded_buffer == nullptr) { |
6785 | 6797 | return nullptr; |
@@ -7401,10 +7413,18 @@ namespace dom { |
7401 | 7413 | // |
7402 | 7414 | // parser inline implementation |
7403 | 7415 | // |
| 7416 | +#if defined(_MSC_VER) && _MSC_VER < 1910 |
| 7417 | +// older versions of Visual Studio lack proper support for unique_ptr. |
| 7418 | +really_inline parser::parser(size_t max_capacity) noexcept |
| 7419 | + : _max_capacity{max_capacity}, |
| 7420 | + loaded_bytes(nullptr) { |
| 7421 | +} |
| 7422 | +#else |
7404 | 7423 | really_inline parser::parser(size_t max_capacity) noexcept |
7405 | 7424 | : _max_capacity{max_capacity}, |
7406 | 7425 | loaded_bytes(nullptr, &aligned_free_char) { |
7407 | 7426 | } |
| 7427 | +#endif |
7408 | 7428 | really_inline parser::parser(parser &&other) noexcept = default; |
7409 | 7429 | really_inline parser &parser::operator=(parser &&other) noexcept = default; |
7410 | 7430 |
|
|
0 commit comments