Merge pull request #859 from simdjson/jkeiser/vsquickstart
Eliminate Intellisense errors and warnings in new VS project
This commit is contained in:
commit
25fe6d7dde
|
@ -2,6 +2,7 @@
|
|||
#define __BENCHMARKER_H
|
||||
|
||||
#include "event_counter.h"
|
||||
#include "simdjson.h" // For SIMDJSON_DISABLE_DEPRECATED_WARNINGS
|
||||
|
||||
#include <cassert>
|
||||
#include <cctype>
|
||||
|
@ -435,7 +436,11 @@ struct benchmarker {
|
|||
void print(bool tabbed_output) const {
|
||||
if (tabbed_output) {
|
||||
char* filename_copy = (char*)malloc(strlen(filename)+1);
|
||||
SIMDJSON_PUSH_DISABLE_WARNINGS
|
||||
SIMDJSON_DISABLE_DEPRECATED_WARNING // Validated CRT_SECURE safe here
|
||||
strcpy(filename_copy, filename);
|
||||
SIMDJSON_POP_DISABLE_WARNINGS
|
||||
|
||||
#if defined(__linux__)
|
||||
char* base = ::basename(filename_copy);
|
||||
#else
|
||||
|
|
|
@ -11,9 +11,7 @@
|
|||
#include "simdjson/common_defs.h"
|
||||
|
||||
SIMDJSON_PUSH_DISABLE_WARNINGS
|
||||
#if defined(_MSC_VER) && defined(__clang__)
|
||||
SIMDJSON_DISABLE_GCC_WARNING(-Wmicrosoft-include)
|
||||
#endif
|
||||
SIMDJSON_DISABLE_UNDESIRED_WARNINGS
|
||||
|
||||
// Public API
|
||||
#include "simdjson/simdjson_version.h"
|
||||
|
|
|
@ -77,9 +77,12 @@ constexpr size_t DEFAULT_MAX_DEPTH = 1024;
|
|||
#define unlikely(x) x
|
||||
#endif
|
||||
|
||||
#include <CppCoreCheck\Warnings.h>
|
||||
#define SIMDJSON_PUSH_DISABLE_WARNINGS __pragma(warning( push ))
|
||||
#define SIMDJSON_PUSH_DISABLE_ALL_WARNINGS __pragma(warning( push, 0 ))
|
||||
#define SIMDJSON_DISABLE_VS_WARNING(WARNING_NUMBER) __pragma(warning( disable : WARNING_NUMBER ))
|
||||
// Get rid of Intellisense-only warnings (Code Analysis)
|
||||
#define SIMDJSON_DISABLE_UNDESIRED_WARNINGS SIMDJSON_DISABLE_VS_WARNING(ALL_CPPCORECHECK_WARNINGS)
|
||||
#define SIMDJSON_DISABLE_DEPRECATED_WARNING SIMDJSON_DISABLE_VS_WARNING(4996)
|
||||
#define SIMDJSON_POP_DISABLE_WARNINGS __pragma(warning( pop ))
|
||||
|
||||
|
@ -113,6 +116,11 @@ constexpr size_t DEFAULT_MAX_DEPTH = 1024;
|
|||
SIMDJSON_DISABLE_GCC_WARNING(-Wunused-variable)
|
||||
#define SIMDJSON_PRAGMA(P) _Pragma(#P)
|
||||
#define SIMDJSON_DISABLE_GCC_WARNING(WARNING) SIMDJSON_PRAGMA(GCC diagnostic ignored #WARNING)
|
||||
#if defined(SIMDJSON_CLANG_VISUAL_STUDIO)
|
||||
#define SIMDJSON_DISABLE_UNDESIRED_WARNINGS SIMDJSON_DISABLE_GCC_WARNING(-Wmicrosoft-include)
|
||||
#else
|
||||
#define SIMDJSON_DISABLE_UNDESIRED_WARNINGS
|
||||
#endif
|
||||
#define SIMDJSON_DISABLE_DEPRECATED_WARNING SIMDJSON_DISABLE_GCC_WARNING(-Wdeprecated-declarations)
|
||||
#define SIMDJSON_POP_DISABLE_WARNINGS _Pragma("GCC diagnostic pop")
|
||||
|
||||
|
|
|
@ -339,7 +339,11 @@ inline bool parser::dump_raw_tape(std::ostream &os) const noexcept {
|
|||
|
||||
inline simdjson_result<size_t> parser::read_file(const std::string &path) noexcept {
|
||||
// Open the file
|
||||
SIMDJSON_PUSH_DISABLE_WARNINGS
|
||||
SIMDJSON_DISABLE_DEPRECATED_WARNING // Disable CRT_SECURE warning on MSVC: manually verified this is safe
|
||||
std::FILE *fp = std::fopen(path.c_str(), "rb");
|
||||
SIMDJSON_POP_DISABLE_WARNINGS
|
||||
|
||||
if (fp == nullptr) {
|
||||
return IO_ERROR;
|
||||
}
|
||||
|
|
|
@ -102,7 +102,11 @@ inline padded_string::operator std::string_view() const { return std::string_vie
|
|||
|
||||
inline simdjson_result<padded_string> padded_string::load(const std::string &filename) noexcept {
|
||||
// Open the file
|
||||
SIMDJSON_PUSH_DISABLE_WARNINGS
|
||||
SIMDJSON_DISABLE_DEPRECATED_WARNING // Disable CRT_SECURE warning on MSVC: manually verified this is safe
|
||||
std::FILE *fp = std::fopen(filename.c_str(), "rb");
|
||||
SIMDJSON_POP_DISABLE_WARNINGS
|
||||
|
||||
if (fp == nullptr) {
|
||||
return IO_ERROR;
|
||||
}
|
||||
|
|
|
@ -39,7 +39,6 @@ add_library(simdjson-internal-flags INTERFACE)
|
|||
target_link_libraries(simdjson-internal-flags INTERFACE simdjson-flags)
|
||||
|
||||
if(MSVC)
|
||||
target_compile_options(simdjson-internal-flags INTERFACE /nologo /D_CRT_SECURE_NO_WARNINGS)
|
||||
target_compile_options(simdjson-internal-flags INTERFACE /WX /W3 /sdl)
|
||||
else()
|
||||
target_compile_options(simdjson-internal-flags INTERFACE -fPIC)
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,5 +1,5 @@
|
|||
/* auto-generated on Mon 27 Apr 2020 21:20:37 EDT. Do not edit! */
|
||||
/* begin file simdjson.h */
|
||||
/* auto-generated on Mon May 4 11:46:14 PDT 2020. Do not edit! */
|
||||
/* begin file include/simdjson.h */
|
||||
#ifndef SIMDJSON_H
|
||||
#define SIMDJSON_H
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
|||
* Check the [README.md](https://github.com/lemire/simdjson/blob/master/README.md#simdjson--parsing-gigabytes-of-json-per-second).
|
||||
*/
|
||||
|
||||
/* begin file simdjson/compiler_check.h */
|
||||
/* begin file include/simdjson/compiler_check.h */
|
||||
#ifndef SIMDJSON_COMPILER_CHECK_H
|
||||
#define SIMDJSON_COMPILER_CHECK_H
|
||||
|
||||
|
@ -45,13 +45,13 @@
|
|||
#endif
|
||||
|
||||
#endif // SIMDJSON_COMPILER_CHECK_H
|
||||
/* end file */
|
||||
/* begin file simdjson/common_defs.h */
|
||||
/* end file include/simdjson/compiler_check.h */
|
||||
/* begin file include/simdjson/common_defs.h */
|
||||
#ifndef SIMDJSON_COMMON_DEFS_H
|
||||
#define SIMDJSON_COMMON_DEFS_H
|
||||
|
||||
#include <cassert>
|
||||
/* begin file simdjson/portability.h */
|
||||
/* begin file include/simdjson/portability.h */
|
||||
#ifndef SIMDJSON_PORTABILITY_H
|
||||
#define SIMDJSON_PORTABILITY_H
|
||||
|
||||
|
@ -201,8 +201,13 @@ compiling for a known 64-bit platform."
|
|||
// regular visual studio and clang under visual studio.
|
||||
// clang under Windows has _stricmp (like visual studio) but not strcasecmp (as clang normally has)
|
||||
#define simdjson_strcasecmp _stricmp
|
||||
#define simdjson_strncasecmp _strnicmp
|
||||
#else
|
||||
// The strcasecmp, strncasecmp, and strcasestr functions do not work with multibyte strings (e.g. UTF-8).
|
||||
// So they are only useful for ASCII in our context.
|
||||
// https://www.gnu.org/software/libunistring/manual/libunistring.html#char-_002a-strings
|
||||
#define simdjson_strcasecmp strcasecmp
|
||||
#define simdjson_strncasecmp strncasecmp
|
||||
#endif
|
||||
|
||||
namespace simdjson {
|
||||
|
@ -248,7 +253,7 @@ static inline void aligned_free_char(char *mem_block) {
|
|||
}
|
||||
} // namespace simdjson
|
||||
#endif // SIMDJSON_PORTABILITY_H
|
||||
/* end file */
|
||||
/* end file include/simdjson/portability.h */
|
||||
|
||||
namespace simdjson {
|
||||
|
||||
|
@ -323,9 +328,12 @@ constexpr size_t DEFAULT_MAX_DEPTH = 1024;
|
|||
#define unlikely(x) x
|
||||
#endif
|
||||
|
||||
#include <CppCoreCheck\Warnings.h>
|
||||
#define SIMDJSON_PUSH_DISABLE_WARNINGS __pragma(warning( push ))
|
||||
#define SIMDJSON_PUSH_DISABLE_ALL_WARNINGS __pragma(warning( push, 0 ))
|
||||
#define SIMDJSON_DISABLE_VS_WARNING(WARNING_NUMBER) __pragma(warning( disable : WARNING_NUMBER ))
|
||||
// Get rid of Intellisense-only warnings (Code Analysis)
|
||||
#define SIMDJSON_DISABLE_UNDESIRED_WARNINGS SIMDJSON_DISABLE_VS_WARNING(ALL_CPPCORECHECK_WARNINGS)
|
||||
#define SIMDJSON_DISABLE_DEPRECATED_WARNING SIMDJSON_DISABLE_VS_WARNING(4996)
|
||||
#define SIMDJSON_POP_DISABLE_WARNINGS __pragma(warning( pop ))
|
||||
|
||||
|
@ -359,6 +367,11 @@ constexpr size_t DEFAULT_MAX_DEPTH = 1024;
|
|||
SIMDJSON_DISABLE_GCC_WARNING(-Wunused-variable)
|
||||
#define SIMDJSON_PRAGMA(P) _Pragma(#P)
|
||||
#define SIMDJSON_DISABLE_GCC_WARNING(WARNING) SIMDJSON_PRAGMA(GCC diagnostic ignored #WARNING)
|
||||
#if defined(SIMDJSON_CLANG_VISUAL_STUDIO)
|
||||
#define SIMDJSON_DISABLE_UNDESIRED_WARNINGS SIMDJSON_DISABLE_GCC_WARNING(-Wmicrosoft-include)
|
||||
#else
|
||||
#define SIMDJSON_DISABLE_UNDESIRED_WARNINGS
|
||||
#endif
|
||||
#define SIMDJSON_DISABLE_DEPRECATED_WARNING SIMDJSON_DISABLE_GCC_WARNING(-Wdeprecated-declarations)
|
||||
#define SIMDJSON_POP_DISABLE_WARNINGS _Pragma("GCC diagnostic pop")
|
||||
|
||||
|
@ -423,7 +436,7 @@ constexpr size_t DEFAULT_MAX_DEPTH = 1024;
|
|||
//
|
||||
#ifndef SIMDJSON_HAS_STRING_VIEW
|
||||
SIMDJSON_PUSH_DISABLE_ALL_WARNINGS
|
||||
/* begin file simdjson/nonstd/string_view.hpp */
|
||||
/* begin file include/simdjson/nonstd/string_view.hpp */
|
||||
// Copyright 2017-2019 by Martin Moene
|
||||
//
|
||||
// string-view lite, a C++17-like string_view for C++98 and later.
|
||||
|
@ -1953,7 +1966,7 @@ nssv_RESTORE_WARNINGS()
|
|||
|
||||
#endif // nssv_HAVE_STD_STRING_VIEW
|
||||
#endif // NONSTD_SV_LITE_H_INCLUDED
|
||||
/* end file */
|
||||
/* end file include/simdjson/nonstd/string_view.hpp */
|
||||
SIMDJSON_POP_DISABLE_WARNINGS
|
||||
|
||||
namespace std {
|
||||
|
@ -1963,15 +1976,13 @@ namespace std {
|
|||
#undef SIMDJSON_HAS_STRING_VIEW // We are not going to need this macro anymore.
|
||||
|
||||
#endif // SIMDJSON_COMMON_DEFS_H
|
||||
/* end file */
|
||||
/* end file include/simdjson/nonstd/string_view.hpp */
|
||||
|
||||
SIMDJSON_PUSH_DISABLE_WARNINGS
|
||||
#if defined(_MSC_VER) && defined(__clang__)
|
||||
SIMDJSON_DISABLE_GCC_WARNING(-Wmicrosoft-include)
|
||||
#endif
|
||||
SIMDJSON_DISABLE_UNDESIRED_WARNINGS
|
||||
|
||||
// Public API
|
||||
/* begin file simdjson/simdjson_version.h */
|
||||
/* begin file include/simdjson/simdjson_version.h */
|
||||
// /include/simdjson/simdjson_version.h automatically generated by release.py,
|
||||
// do not change by hand
|
||||
#ifndef SIMDJSON_SIMDJSON_VERSION_H
|
||||
|
@ -1998,8 +2009,8 @@ enum {
|
|||
} // namespace simdjson
|
||||
|
||||
#endif // SIMDJSON_SIMDJSON_VERSION_H
|
||||
/* end file */
|
||||
/* begin file simdjson/error.h */
|
||||
/* end file include/simdjson/simdjson_version.h */
|
||||
/* begin file include/simdjson/error.h */
|
||||
#ifndef SIMDJSON_ERROR_H
|
||||
#define SIMDJSON_ERROR_H
|
||||
|
||||
|
@ -2232,8 +2243,8 @@ inline const std::string &error_message(int error) noexcept;
|
|||
} // namespace simdjson
|
||||
|
||||
#endif // SIMDJSON_ERROR_H
|
||||
/* end file */
|
||||
/* begin file simdjson/padded_string.h */
|
||||
/* end file include/simdjson/error.h */
|
||||
/* begin file include/simdjson/padded_string.h */
|
||||
#ifndef SIMDJSON_PADDED_STRING_H
|
||||
#define SIMDJSON_PADDED_STRING_H
|
||||
|
||||
|
@ -2373,8 +2384,8 @@ inline char *allocate_padded_buffer(size_t length) noexcept;
|
|||
} // namespace simdjson
|
||||
|
||||
#endif // SIMDJSON_PADDED_STRING_H
|
||||
/* end file */
|
||||
/* begin file simdjson/implementation.h */
|
||||
/* end file include/simdjson/padded_string.h */
|
||||
/* begin file include/simdjson/implementation.h */
|
||||
#ifndef SIMDJSON_IMPLEMENTATION_H
|
||||
#define SIMDJSON_IMPLEMENTATION_H
|
||||
|
||||
|
@ -2382,7 +2393,7 @@ inline char *allocate_padded_buffer(size_t length) noexcept;
|
|||
#include <string>
|
||||
#include <atomic>
|
||||
#include <vector>
|
||||
/* begin file simdjson/document.h */
|
||||
/* begin file include/simdjson/document.h */
|
||||
#ifndef SIMDJSON_DOCUMENT_H
|
||||
#define SIMDJSON_DOCUMENT_H
|
||||
|
||||
|
@ -2391,7 +2402,7 @@ inline char *allocate_padded_buffer(size_t length) noexcept;
|
|||
#include <string>
|
||||
#include <limits>
|
||||
#include <sstream>
|
||||
/* begin file simdjson/simdjson.h */
|
||||
/* begin file include/simdjson/simdjson.h */
|
||||
/**
|
||||
* @file
|
||||
* @deprecated We'll be removing this file so it isn't confused with the top level simdjson.h
|
||||
|
@ -2401,7 +2412,7 @@ inline char *allocate_padded_buffer(size_t length) noexcept;
|
|||
|
||||
|
||||
#endif // SIMDJSON_H
|
||||
/* end file */
|
||||
/* end file include/simdjson/simdjson.h */
|
||||
|
||||
namespace simdjson {
|
||||
namespace dom {
|
||||
|
@ -2706,6 +2717,7 @@ public:
|
|||
|
||||
/**
|
||||
* Get the value associated with the given key in a case-insensitive manner.
|
||||
* It is only guaranteed to work over ASCII inputs.
|
||||
*
|
||||
* Note: The key will be matched against **unescaped** JSON.
|
||||
*
|
||||
|
@ -3731,7 +3743,7 @@ public:
|
|||
} // namespace simdjson
|
||||
|
||||
#endif // SIMDJSON_DOCUMENT_H
|
||||
/* end file */
|
||||
/* end file include/simdjson/simdjson.h */
|
||||
|
||||
namespace simdjson {
|
||||
|
||||
|
@ -3963,8 +3975,8 @@ extern SIMDJSON_DLLIMPORTEXPORT internal::atomic_ptr<const implementation> activ
|
|||
} // namespace simdjson
|
||||
|
||||
#endif // SIMDJSON_IMPLEMENTATION_H
|
||||
/* end file */
|
||||
/* begin file simdjson/document_stream.h */
|
||||
/* end file include/simdjson/simdjson.h */
|
||||
/* begin file include/simdjson/document_stream.h */
|
||||
#ifndef SIMDJSON_DOCUMENT_STREAM_H
|
||||
#define SIMDJSON_DOCUMENT_STREAM_H
|
||||
|
||||
|
@ -4111,16 +4123,16 @@ private:
|
|||
} // namespace simdjson
|
||||
|
||||
#endif // SIMDJSON_DOCUMENT_STREAM_H
|
||||
/* end file */
|
||||
/* end file include/simdjson/document_stream.h */
|
||||
|
||||
// // Deprecated API
|
||||
/* begin file simdjson/jsonparser.h */
|
||||
/* begin file include/simdjson/jsonparser.h */
|
||||
// TODO Remove this -- deprecated API and files
|
||||
|
||||
#ifndef SIMDJSON_JSONPARSER_H
|
||||
#define SIMDJSON_JSONPARSER_H
|
||||
|
||||
/* begin file simdjson/parsedjson.h */
|
||||
/* begin file include/simdjson/parsedjson.h */
|
||||
// TODO Remove this -- deprecated API and files
|
||||
|
||||
#ifndef SIMDJSON_PARSEDJSON_H
|
||||
|
@ -4136,8 +4148,8 @@ using ParsedJson [[deprecated("Use dom::parser instead")]] = dom::parser;
|
|||
|
||||
} // namespace simdjson
|
||||
#endif
|
||||
/* end file */
|
||||
/* begin file simdjson/jsonioutil.h */
|
||||
/* end file include/simdjson/parsedjson.h */
|
||||
/* begin file include/simdjson/jsonioutil.h */
|
||||
#ifndef SIMDJSON_JSONIOUTIL_H
|
||||
#define SIMDJSON_JSONIOUTIL_H
|
||||
|
||||
|
@ -4163,7 +4175,7 @@ inline padded_string get_corpus(const char *path) {
|
|||
} // namespace simdjson
|
||||
|
||||
#endif // SIMDJSON_JSONIOUTIL_H
|
||||
/* end file */
|
||||
/* end file include/simdjson/jsonioutil.h */
|
||||
|
||||
namespace simdjson {
|
||||
|
||||
|
@ -4273,8 +4285,8 @@ dom::parser build_parsed_json(const char *buf) noexcept = delete;
|
|||
} // namespace simdjson
|
||||
|
||||
#endif
|
||||
/* end file */
|
||||
/* begin file simdjson/parsedjson_iterator.h */
|
||||
/* end file include/simdjson/jsonioutil.h */
|
||||
/* begin file include/simdjson/parsedjson_iterator.h */
|
||||
// TODO Remove this -- deprecated API and files
|
||||
|
||||
#ifndef SIMDJSON_PARSEDJSON_ITERATOR_H
|
||||
|
@ -4287,7 +4299,7 @@ dom::parser build_parsed_json(const char *buf) noexcept = delete;
|
|||
#include <limits>
|
||||
#include <stdexcept>
|
||||
|
||||
/* begin file simdjson/internal/jsonformatutils.h */
|
||||
/* begin file include/simdjson/internal/jsonformatutils.h */
|
||||
#ifndef SIMDJSON_INTERNAL_JSONFORMATUTILS_H
|
||||
#define SIMDJSON_INTERNAL_JSONFORMATUTILS_H
|
||||
|
||||
|
@ -4353,7 +4365,7 @@ inline std::ostream& operator<<(std::ostream& out, const escape_json_string &une
|
|||
} // namespace simdjson
|
||||
|
||||
#endif // SIMDJSON_INTERNAL_JSONFORMATUTILS_H
|
||||
/* end file */
|
||||
/* end file include/simdjson/internal/jsonformatutils.h */
|
||||
|
||||
namespace simdjson {
|
||||
|
||||
|
@ -4608,10 +4620,10 @@ public:
|
|||
} // namespace simdjson
|
||||
|
||||
#endif
|
||||
/* end file */
|
||||
/* end file include/simdjson/internal/jsonformatutils.h */
|
||||
|
||||
// // Inline functions
|
||||
/* begin file simdjson/inline/document.h */
|
||||
/* begin file include/simdjson/inline/document.h */
|
||||
#ifndef SIMDJSON_INLINE_DOCUMENT_H
|
||||
#define SIMDJSON_INLINE_DOCUMENT_H
|
||||
|
||||
|
@ -4948,7 +4960,11 @@ inline bool parser::dump_raw_tape(std::ostream &os) const noexcept {
|
|||
|
||||
inline simdjson_result<size_t> parser::read_file(const std::string &path) noexcept {
|
||||
// Open the file
|
||||
SIMDJSON_PUSH_DISABLE_WARNINGS
|
||||
SIMDJSON_DISABLE_DEPRECATED_WARNING // Disable CRT_SECURE warning on MSVC: manually verified this is safe
|
||||
std::FILE *fp = std::fopen(path.c_str(), "rb");
|
||||
SIMDJSON_POP_DISABLE_WARNINGS
|
||||
|
||||
if (fp == nullptr) {
|
||||
return IO_ERROR;
|
||||
}
|
||||
|
@ -5295,10 +5311,10 @@ inline simdjson_result<element> object::at_key_case_insensitive(const std::strin
|
|||
for (iterator field = begin(); field != end_field; ++field) {
|
||||
auto field_key = field.key();
|
||||
if (key.length() == field_key.length()) {
|
||||
bool equal = true;
|
||||
for (size_t i=0; i<field_key.length(); i++) {
|
||||
equal = equal && std::tolower(key[i]) != std::tolower(field_key[i]);
|
||||
}
|
||||
// See For case-insensitive string comparisons, avoid char-by-char functions
|
||||
// https://lemire.me/blog/2020/04/30/for-case-insensitive-string-comparisons-avoid-char-by-char-functions/
|
||||
// Note that it might be worth rolling our own strncasecmp function, with vectorization.
|
||||
const bool equal = (simdjson_strncasecmp(key.data(), field_key.data(), key.length()) == 0);
|
||||
if (equal) { return field.value(); }
|
||||
}
|
||||
}
|
||||
|
@ -5784,8 +5800,8 @@ inline std::string_view internal::tape_ref::get_string_view() const noexcept {
|
|||
} // namespace simdjson
|
||||
|
||||
#endif // SIMDJSON_INLINE_DOCUMENT_H
|
||||
/* end file */
|
||||
/* begin file simdjson/inline/document_stream.h */
|
||||
/* end file include/simdjson/inline/document.h */
|
||||
/* begin file include/simdjson/inline/document_stream.h */
|
||||
#ifndef SIMDJSON_INLINE_DOCUMENT_STREAM_H
|
||||
#define SIMDJSON_INLINE_DOCUMENT_STREAM_H
|
||||
|
||||
|
@ -6071,8 +6087,8 @@ inline error_code document_stream::json_parse() noexcept {
|
|||
} // namespace dom
|
||||
} // namespace simdjson
|
||||
#endif // SIMDJSON_INLINE_DOCUMENT_STREAM_H
|
||||
/* end file */
|
||||
/* begin file simdjson/inline/error.h */
|
||||
/* end file include/simdjson/inline/document_stream.h */
|
||||
/* begin file include/simdjson/inline/error.h */
|
||||
#ifndef SIMDJSON_INLINE_ERROR_H
|
||||
#define SIMDJSON_INLINE_ERROR_H
|
||||
|
||||
|
@ -6211,8 +6227,8 @@ really_inline simdjson_result<T>::simdjson_result() noexcept
|
|||
} // namespace simdjson
|
||||
|
||||
#endif // SIMDJSON_INLINE_ERROR_H
|
||||
/* end file */
|
||||
/* begin file simdjson/inline/padded_string.h */
|
||||
/* end file include/simdjson/inline/error.h */
|
||||
/* begin file include/simdjson/inline/padded_string.h */
|
||||
#ifndef SIMDJSON_INLINE_PADDED_STRING_H
|
||||
#define SIMDJSON_INLINE_PADDED_STRING_H
|
||||
|
||||
|
@ -6315,7 +6331,11 @@ inline padded_string::operator std::string_view() const { return std::string_vie
|
|||
|
||||
inline simdjson_result<padded_string> padded_string::load(const std::string &filename) noexcept {
|
||||
// Open the file
|
||||
SIMDJSON_PUSH_DISABLE_WARNINGS
|
||||
SIMDJSON_DISABLE_DEPRECATED_WARNING // Disable CRT_SECURE warning on MSVC: manually verified this is safe
|
||||
std::FILE *fp = std::fopen(filename.c_str(), "rb");
|
||||
SIMDJSON_POP_DISABLE_WARNINGS
|
||||
|
||||
if (fp == nullptr) {
|
||||
return IO_ERROR;
|
||||
}
|
||||
|
@ -6352,8 +6372,8 @@ inline simdjson_result<padded_string> padded_string::load(const std::string &fil
|
|||
} // namespace simdjson
|
||||
|
||||
#endif // SIMDJSON_INLINE_PADDED_STRING_H
|
||||
/* end file */
|
||||
/* begin file simdjson/inline/parsedjson_iterator.h */
|
||||
/* end file include/simdjson/inline/padded_string.h */
|
||||
/* begin file include/simdjson/inline/parsedjson_iterator.h */
|
||||
#ifndef SIMDJSON_INLINE_PARSEDJSON_ITERATOR_H
|
||||
#define SIMDJSON_INLINE_PARSEDJSON_ITERATOR_H
|
||||
|
||||
|
@ -6837,9 +6857,9 @@ SIMDJSON_POP_DISABLE_WARNINGS
|
|||
} // namespace simdjson
|
||||
|
||||
#endif // SIMDJSON_INLINE_PARSEDJSON_ITERATOR_H
|
||||
/* end file */
|
||||
/* end file include/simdjson/inline/parsedjson_iterator.h */
|
||||
|
||||
SIMDJSON_POP_DISABLE_WARNINGS
|
||||
|
||||
#endif // SIMDJSON_H
|
||||
/* end file */
|
||||
/* end file include/simdjson/inline/parsedjson_iterator.h */
|
||||
|
|
|
@ -122,7 +122,11 @@ const implementation *available_implementation_list::detect_best_supported() con
|
|||
}
|
||||
|
||||
const implementation *detect_best_supported_implementation_on_first_use::set_best() const noexcept {
|
||||
SIMDJSON_PUSH_DISABLE_WARNINGS
|
||||
SIMDJSON_DISABLE_DEPRECATED_WARNING // Disable CRT_SECURE warning on MSVC: manually verified this is safe
|
||||
char *force_implementation_name = getenv("SIMDJSON_FORCE_IMPLEMENTATION");
|
||||
SIMDJSON_POP_DISABLE_WARNINGS
|
||||
|
||||
if (force_implementation_name) {
|
||||
auto force_implementation = available_implementations[force_implementation_name];
|
||||
if (!force_implementation) {
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
#include "simdjson.h"
|
||||
|
||||
#if defined(SIMDJSON_CLANG_VISUAL_STUDIO)
|
||||
SIMDJSON_DISABLE_GCC_WARNING(-Wmicrosoft-include)
|
||||
#endif
|
||||
|
||||
SIMDJSON_PUSH_DISABLE_WARNINGS
|
||||
SIMDJSON_DISABLE_UNDESIRED_WARNINGS
|
||||
|
||||
#include "error.cpp"
|
||||
#include "implementation.cpp"
|
||||
#include "stage1_find_marks.cpp"
|
||||
#include "stage2_build_tape.cpp"
|
||||
|
||||
SIMDJSON_POP_DISABLE_WARNINGS
|
||||
|
|
|
@ -74,8 +74,8 @@ namespace number_tests {
|
|||
uint64_t maxulp = 0;
|
||||
for (int i = -1075; i < 1024; ++i) {// large negative values should be zero.
|
||||
double expected = pow(2, i);
|
||||
auto n = sprintf(buf, "%.*e", std::numeric_limits<double>::max_digits10 - 1, expected);
|
||||
buf[n] = '\0';
|
||||
size_t n = snprintf(buf, sizeof(buf), "%.*e", std::numeric_limits<double>::max_digits10 - 1, expected);
|
||||
if (n >= sizeof(buf)) { abort(); }
|
||||
fflush(NULL);
|
||||
auto [actual, error] = parser.parse(buf, n).get<double>();
|
||||
if (error) { std::cerr << error << std::endl; return false; }
|
||||
|
@ -167,8 +167,8 @@ namespace number_tests {
|
|||
char buf[1024];
|
||||
simdjson::dom::parser parser;
|
||||
for (int i = -1000000; i <= 308; ++i) {// large negative values should be zero.
|
||||
auto n = sprintf(buf,"1e%d", i);
|
||||
buf[n] = '\0';
|
||||
size_t n = snprintf(buf, sizeof(buf), "1e%d", i);
|
||||
if (n >= sizeof(buf)) { abort(); }
|
||||
fflush(NULL);
|
||||
|
||||
auto [actual, error] = parser.parse(buf, n).get<double>();
|
||||
|
@ -275,19 +275,22 @@ namespace document_tests {
|
|||
std::vector<std::string> data;
|
||||
char buf[1024];
|
||||
for (size_t i = 0; i < n_records; ++i) {
|
||||
auto n = sprintf(buf,
|
||||
size_t n = snprintf(buf, sizeof(buf),
|
||||
"{\"id\": %zu, \"name\": \"name%zu\", \"gender\": \"%s\", "
|
||||
"\"school\": {\"id\": %zu, \"name\": \"school%zu\"}}",
|
||||
i, i, (i % 2) ? "male" : "female", i % 10, i % 10);
|
||||
if (n >= sizeof(buf)) { abort(); }
|
||||
data.emplace_back(std::string(buf, n));
|
||||
}
|
||||
for (size_t i = 0; i < n_records; ++i) {
|
||||
auto n = sprintf(buf, "{\"counter\": %f, \"array\": [%s]}", static_cast<double>(i) * 3.1416,
|
||||
size_t n = snprintf(buf, sizeof(buf), "{\"counter\": %f, \"array\": [%s]}", static_cast<double>(i) * 3.1416,
|
||||
(i % 2) ? "true" : "false");
|
||||
if (n >= sizeof(buf)) { abort(); }
|
||||
data.emplace_back(std::string(buf, n));
|
||||
}
|
||||
for (size_t i = 0; i < n_records; ++i) {
|
||||
auto n = sprintf(buf, "{\"number\": %e}", static_cast<double>(i) * 10000.31321321);
|
||||
size_t n = snprintf(buf, sizeof(buf), "{\"number\": %e}", static_cast<double>(i) * 10000.31321321);
|
||||
if (n >= sizeof(buf)) { abort(); }
|
||||
data.emplace_back(std::string(buf, n));
|
||||
}
|
||||
data.emplace_back(std::string("true"));
|
||||
|
@ -396,10 +399,12 @@ namespace document_stream_tests {
|
|||
std::string data;
|
||||
char buf[1024];
|
||||
for (size_t i = 0; i < n_records; ++i) {
|
||||
auto n = sprintf(buf,
|
||||
size_t n = snprintf(buf,
|
||||
sizeof(buf),
|
||||
"{\"id\": %zu, \"name\": \"name%zu\", \"gender\": \"%s\", "
|
||||
"\"ete\": {\"id\": %zu, \"name\": \"eventail%zu\"}}",
|
||||
i, i, (i % 2) ? "homme" : "femme", i % 10, i % 10);
|
||||
if (n >= sizeof(buf)) { abort(); }
|
||||
data += std::string(buf, n);
|
||||
}
|
||||
for(size_t batch_size = 1000; batch_size < 2000; batch_size += (batch_size>1050?10:1)) {
|
||||
|
@ -444,10 +449,12 @@ namespace document_stream_tests {
|
|||
std::string data;
|
||||
char buf[1024];
|
||||
for (size_t i = 0; i < n_records; ++i) {
|
||||
auto n = sprintf(buf,
|
||||
size_t n = snprintf(buf,
|
||||
sizeof(buf),
|
||||
"{\"id\": %zu, \"name\": \"name%zu\", \"gender\": \"%s\", "
|
||||
"\"été\": {\"id\": %zu, \"name\": \"éventail%zu\"}}",
|
||||
i, i, (i % 2) ? "⺃" : "⺕", i % 10, i % 10);
|
||||
if (n >= sizeof(buf)) { abort(); }
|
||||
data += std::string(buf, n);
|
||||
}
|
||||
for(size_t batch_size = 1000; batch_size < 2000; batch_size += (batch_size>1050?10:1)) {
|
||||
|
|
|
@ -55,15 +55,11 @@ bool validate(const char *dirname) {
|
|||
if (has_extension(name, extension)) {
|
||||
printf("validating: file %s ", name);
|
||||
fflush(nullptr);
|
||||
size_t filelen = strlen(name);
|
||||
char *fullpath = static_cast<char *>(malloc(dirlen + filelen + 1 + 1));
|
||||
strcpy(fullpath, dirname);
|
||||
if (needsep) {
|
||||
fullpath[dirlen] = '/';
|
||||
strcpy(fullpath + dirlen + 1, name);
|
||||
} else {
|
||||
strcpy(fullpath + dirlen, name);
|
||||
}
|
||||
size_t namelen = strlen(name);
|
||||
size_t fullpathlen = dirlen + 1 + namelen + 1;
|
||||
char *fullpath = static_cast<char *>(malloc(fullpathlen));
|
||||
snprintf(fullpath, fullpathlen, "%s%s%s", dirname, needsep ? "/" : "", name);
|
||||
|
||||
auto [p, error] = simdjson::padded_string::load(fullpath);
|
||||
if (error) {
|
||||
std::cerr << "Could not load the file " << fullpath << std::endl;
|
||||
|
|
|
@ -63,16 +63,10 @@ bool validate(const char *dirname) {
|
|||
/* Finding the file path */
|
||||
printf("validating: file %s ", name);
|
||||
fflush(nullptr);
|
||||
size_t filelen = strlen(name);
|
||||
char *fullpath = static_cast<char *>(malloc(dirlen + filelen + 1 + 1));
|
||||
strcpy(fullpath, dirname);
|
||||
if (needsep) {
|
||||
fullpath[dirlen] = '/';
|
||||
strcpy(fullpath + dirlen + 1, name);
|
||||
} else {
|
||||
strcpy(fullpath + dirlen, name);
|
||||
}
|
||||
|
||||
size_t namelen = strlen(name);
|
||||
size_t fullpathlen = dirlen + 1 + namelen + 1;
|
||||
char *fullpath = static_cast<char *>(malloc(fullpathlen));
|
||||
snprintf(fullpath, fullpathlen, "%s%s%s", dirname, needsep ? "/" : "", name);
|
||||
|
||||
/* The actual test*/
|
||||
auto [json, error] = simdjson::padded_string::load(fullpath);
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
add_library(simdjson-windows-headers INTERFACE)
|
||||
if(MSVC)
|
||||
target_include_directories(simdjson-windows-headers INTERFACE .)
|
||||
# getopt.h triggers bogus CRT_SECURE warnings. If you include them, you need this.
|
||||
target_compile_definitions(simdjson-windows-headers INTERFACE _CRT_SECURE_NO_WARNINGS)
|
||||
endif()
|
||||
|
|
Loading…
Reference in New Issue