Merge pull request #1490 from simdjson/jkeiser/single-ondemand

Don't compile On Demand with extra flags
This commit is contained in:
John Keiser 2021-03-09 16:03:58 -08:00 committed by GitHub
commit cfc965ff9a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
35 changed files with 168 additions and 165 deletions

View File

@ -34,30 +34,7 @@
}
*/
#include "simdjson/compiler_check.h"
#include "simdjson/common_defs.h"
SIMDJSON_PUSH_DISABLE_WARNINGS
SIMDJSON_DISABLE_UNDESIRED_WARNINGS
// Public API
#include "simdjson/simdjson_version.h"
#include "simdjson/error.h"
#include "simdjson/minify.h"
#include "simdjson/padded_string.h"
#include "simdjson/padded_string_view.h"
#include "simdjson/implementation.h"
// Inline functions
#include "simdjson/error-inl.h"
#include "simdjson/padded_string-inl.h"
#include "simdjson/padded_string_view-inl.h"
// DOM
#include "simdjson/dom.h"
// Implementations
#include "simdjson/implementations.h"
SIMDJSON_POP_DISABLE_WARNINGS
#include "simdjson/builtin.h"
#endif // SIMDJSON_H

View File

@ -1,22 +1,7 @@
#ifndef SIMDJSON_ARM64_H
#define SIMDJSON_ARM64_H
#ifdef SIMDJSON_FALLBACK_H
#error "arm64.h must be included before fallback.h"
#endif
#include "simdjson/portability.h"
#ifndef SIMDJSON_IMPLEMENTATION_ARM64
#define SIMDJSON_IMPLEMENTATION_ARM64 (SIMDJSON_IS_ARM64)
#endif
#define SIMDJSON_CAN_ALWAYS_RUN_ARM64 SIMDJSON_IMPLEMENTATION_ARM64 && SIMDJSON_IS_ARM64
#include "simdjson/internal/isadetection.h"
#include "simdjson/internal/jsoncharutils_tables.h"
#include "simdjson/internal/numberparsing_tables.h"
#include "simdjson/internal/simdprune_tables.h"
#include "simdjson/implementation-base.h"
#if SIMDJSON_IMPLEMENTATION_ARM64
@ -42,12 +27,6 @@ namespace arm64 {
#include "simdjson/generic/atomparsing.h"
#include "simdjson/arm64/stringparsing.h"
#include "simdjson/arm64/numberparsing.h"
#include "simdjson/generic/implementation_simdjson_result_base.h"
#include "simdjson/generic/ondemand.h"
// Inline definitions
#include "simdjson/generic/implementation_simdjson_result_base-inl.h"
#include "simdjson/generic/ondemand-inl.h"
#include "simdjson/arm64/end.h"
#endif // SIMDJSON_IMPLEMENTATION_ARM64

View File

@ -1,7 +1,7 @@
#ifndef SIMDJSON_ARM64_IMPLEMENTATION_H
#define SIMDJSON_ARM64_IMPLEMENTATION_H
#include "simdjson.h"
#include "simdjson/base.h"
#include "simdjson/internal/isadetection.h"
namespace simdjson {

View File

@ -1,8 +1,6 @@
#ifndef SIMDJSON_ARM64_INTRINSICS_H
#define SIMDJSON_ARM64_INTRINSICS_H
#include "simdjson.h"
// This should be the correct header whether
// you use visual studio or other compilers.
#include <arm_neon.h>

View File

@ -1,7 +1,7 @@
#ifndef SIMDJSON_ARM64_SIMD_H
#define SIMDJSON_ARM64_SIMD_H
#include "simdjson.h"
#include "simdjson/base.h"
#include "simdjson/internal/simdprune_tables.h"
#include "simdjson/arm64/bitmanipulation.h"
#include <type_traits>

View File

@ -1,7 +1,7 @@
#ifndef SIMDJSON_ARM64_STRINGPARSING_H
#define SIMDJSON_ARM64_STRINGPARSING_H
#include "simdjson.h"
#include "simdjson/base.h"
#include "simdjson/arm64/simd.h"
#include "simdjson/arm64/bitmanipulation.h"

26
include/simdjson/base.h Normal file
View File

@ -0,0 +1,26 @@
#ifndef SIMDJSON_BASE_H
#define SIMDJSON_BASE_H
#include "simdjson/compiler_check.h"
#include "simdjson/common_defs.h"
#include "simdjson/portability.h"
SIMDJSON_PUSH_DISABLE_WARNINGS
SIMDJSON_DISABLE_UNDESIRED_WARNINGS
// Public API
#include "simdjson/simdjson_version.h"
#include "simdjson/error.h"
#include "simdjson/minify.h"
#include "simdjson/padded_string.h"
#include "simdjson/padded_string_view.h"
#include "simdjson/implementation.h"
// Inline functions
#include "simdjson/error-inl.h"
#include "simdjson/padded_string-inl.h"
#include "simdjson/padded_string_view-inl.h"
SIMDJSON_POP_DISABLE_WARNINGS
#endif // SIMDJSON_BASE_H

View File

@ -1,8 +1,9 @@
#ifndef SIMDJSON_BUILTIN_H
#define SIMDJSON_BUILTIN_H
#include "simdjson/portability.h"
#include "simdjson/implementations.h"
// Determine the best builtin implementation
#ifndef SIMDJSON_BUILTIN_IMPLEMENTATION
#if SIMDJSON_CAN_ALWAYS_RUN_HASWELL
#define SIMDJSON_BUILTIN_IMPLEMENTATION haswell
@ -19,6 +20,20 @@
#endif
#endif // SIMDJSON_BUILTIN_IMPLEMENTATION
#define SIMDJSON_IMPLEMENTATION SIMDJSON_BUILTIN_IMPLEMENTATION
// ondemand is only compiled as part of the builtin implementation at present
// Interface declarations
#include "simdjson/generic/implementation_simdjson_result_base.h"
#include "simdjson/generic/ondemand.h"
// Inline definitions
#include "simdjson/generic/implementation_simdjson_result_base-inl.h"
#include "simdjson/generic/ondemand-inl.h"
#undef SIMDJSON_IMPLEMENTATION
namespace simdjson {
/**
* Represents the best statically linked simdjson implementation that can be used by the compiling
@ -32,7 +47,7 @@ namespace simdjson {
*/
namespace builtin = SIMDJSON_BUILTIN_IMPLEMENTATION;
/**
* @overload simdjson::SIMDJSON_BUILTIN_IMPLEMENTATION::ondemand
* @copydoc simdjson::SIMDJSON_BUILTIN_IMPLEMENTATION::ondemand
*/
namespace ondemand = SIMDJSON_BUILTIN_IMPLEMENTATION::ondemand;
/**

View File

@ -1,6 +1,11 @@
#ifndef SIMDJSON_DOM_H
#define SIMDJSON_DOM_H
#include "simdjson/base.h"
SIMDJSON_PUSH_DISABLE_WARNINGS
SIMDJSON_DISABLE_UNDESIRED_WARNINGS
#include "simdjson/dom/array.h"
#include "simdjson/dom/document_stream.h"
#include "simdjson/dom/document.h"
@ -25,4 +30,6 @@
#include "simdjson/internal/tape_ref-inl.h"
#include "simdjson/dom/serialization-inl.h"
SIMDJSON_POP_DISABLE_WARNINGS
#endif // SIMDJSON_DOM_H

View File

@ -1,13 +1,7 @@
#ifndef SIMDJSON_FALLBACK_H
#define SIMDJSON_FALLBACK_H
#include "simdjson/portability.h"
// Default Fallback to on unless a builtin implementation has already been selected.
#ifndef SIMDJSON_IMPLEMENTATION_FALLBACK
#define SIMDJSON_IMPLEMENTATION_FALLBACK 1 // (!SIMDJSON_CAN_ALWAYS_RUN_ARM64 && !SIMDJSON_CAN_ALWAYS_RUN_HASWELL && !SIMDJSON_CAN_ALWAYS_RUN_WESTMERE && !SIMDJSON_CAN_ALWAYS_RUN_PPC64)
#endif
#define SIMDJSON_CAN_ALWAYS_RUN_FALLBACK SIMDJSON_IMPLEMENTATION_FALLBACK
#include "simdjson/implementation-base.h"
#if SIMDJSON_IMPLEMENTATION_FALLBACK
@ -30,13 +24,6 @@ namespace fallback {
#include "simdjson/generic/atomparsing.h"
#include "simdjson/fallback/stringparsing.h"
#include "simdjson/fallback/numberparsing.h"
#include "simdjson/generic/implementation_simdjson_result_base.h"
#include "simdjson/generic/ondemand.h"
// Inline definitions
#include "simdjson/generic/implementation_simdjson_result_base-inl.h"
#include "simdjson/generic/ondemand-inl.h"
#include "simdjson/fallback/end.h"
#endif // SIMDJSON_IMPLEMENTATION_FALLBACK

View File

@ -1,7 +1,7 @@
#ifndef SIMDJSON_FALLBACK_BITMANIPULATION_H
#define SIMDJSON_FALLBACK_BITMANIPULATION_H
#include "simdjson.h"
#include "simdjson/base.h"
#include <limits>
namespace simdjson {

View File

@ -1,7 +1,7 @@
#ifndef SIMDJSON_FALLBACK_STRINGPARSING_H
#define SIMDJSON_FALLBACK_STRINGPARSING_H
#include "simdjson.h"
#include "simdjson/base.h"
namespace simdjson {
namespace SIMDJSON_IMPLEMENTATION {

View File

@ -1,4 +1,4 @@
#include "simdjson.h"
#include "simdjson/base.h"
#include "simdjson/internal/isadetection.h"
namespace simdjson {

View File

@ -1,27 +1,17 @@
#ifndef SIMDJSON_HASWELL_H
#define SIMDJSON_HASWELL_H
#ifdef SIMDJSON_WESTMERE_H
#error "haswell.h must be included before westmere.h"
#endif
#ifdef SIMDJSON_FALLBACK_H
#error "haswell.h must be included before fallback.h"
#endif
#include "simdjson/portability.h"
// Default Haswell to on if this is x86-64. Even if we're not compiled for it, it could be selected
// at runtime.
#ifndef SIMDJSON_IMPLEMENTATION_HASWELL
#define SIMDJSON_IMPLEMENTATION_HASWELL (SIMDJSON_IS_X86_64)
#endif
// To see why (__BMI__) && (__PCLMUL__) && (__LZCNT__) are not part of this next line, see
// https://github.com/simdjson/simdjson/issues/1247
#define SIMDJSON_CAN_ALWAYS_RUN_HASWELL ((SIMDJSON_IMPLEMENTATION_HASWELL) && (SIMDJSON_IS_X86_64) && (__AVX2__))
#include "simdjson/implementation-base.h"
#if SIMDJSON_IMPLEMENTATION_HASWELL
#if SIMDJSON_CAN_ALWAYS_RUN_HASWELL
#define SIMDJSON_TARGET_HASWELL
#define SIMDJSON_UNTARGET_HASWELL
#else
#define SIMDJSON_TARGET_HASWELL SIMDJSON_TARGET_REGION("avx2,bmi,pclmul,lzcnt")
#define SIMDJSON_UNTARGET_HASWELL SIMDJSON_UNTARGET_REGION
#endif
namespace simdjson {
/**
@ -32,7 +22,7 @@ namespace haswell {
} // namespace simdjson
//
// These two need to be included outside SIMDJSON_TARGET_REGION
// These two need to be included outside SIMDJSON_TARGET_HASWELL
//
#include "simdjson/haswell/implementation.h"
#include "simdjson/haswell/intrinsics.h"
@ -51,13 +41,6 @@ namespace haswell {
#include "simdjson/generic/atomparsing.h"
#include "simdjson/haswell/stringparsing.h"
#include "simdjson/haswell/numberparsing.h"
#include "simdjson/generic/implementation_simdjson_result_base.h"
#include "simdjson/generic/ondemand.h"
// Inline definitions
#include "simdjson/generic/implementation_simdjson_result_base-inl.h"
#include "simdjson/generic/ondemand-inl.h"
#include "simdjson/haswell/end.h"
#endif // SIMDJSON_IMPLEMENTATION_HASWELL

View File

@ -1,2 +1,2 @@
SIMDJSON_UNTARGET_REGION
SIMDJSON_UNTARGET_HASWELL
#undef SIMDJSON_IMPLEMENTATION

View File

@ -3,7 +3,7 @@
#include "simdjson/implementation.h"
// The constructor may be executed on any host, so we take care not to use SIMDJSON_TARGET_REGION
// The constructor may be executed on any host, so we take care not to use SIMDJSON_TARGET_HASWELL
namespace simdjson {
namespace haswell {

View File

@ -1,7 +1,7 @@
#ifndef SIMDJSON_HASWELL_INTRINSICS_H
#define SIMDJSON_HASWELL_INTRINSICS_H
#include "simdjson.h"
#include "simdjson/base.h"
#ifdef SIMDJSON_VISUAL_STUDIO
// under clang within visual studio, this will include <x86intrin.h>
@ -45,7 +45,7 @@ SIMDJSON_TARGET_HASWELL
static simdjson_really_inline uint64_t _blsr_u64(uint64_t n) {
return (n - 1) & n;
}
SIMDJSON_UNTARGET_REGION
SIMDJSON_UNTARGET_HASWELL
#endif // _blsr_u64
#endif // SIMDJSON_CLANG_VISUAL_STUDIO

View File

@ -1,7 +1,7 @@
#ifndef SIMDJSON_HASWELL_STRINGPARSING_H
#define SIMDJSON_HASWELL_STRINGPARSING_H
#include "simdjson.h"
#include "simdjson/base.h"
#include "simdjson/haswell/simd.h"
#include "simdjson/haswell/bitmanipulation.h"

View File

@ -0,0 +1,22 @@
#ifndef SIMDJSON_IMPLEMENTATION_BASE_H
#define SIMDJSON_IMPLEMENTATION_BASE_H
/**
* @file
*
* Includes common stuff needed for implementations.
*/
#include "simdjson/base.h"
#include "simdjson/implementation.h"
// Implementation-internal files (must be included before the implementations themselves, to keep
// amalgamation working--otherwise, the first time a file is included, it might be put inside the
// #ifdef SIMDJSON_IMPLEMENTATION_ARM64/FALLBACK/etc., which means the other implementations can't
// compile unless that implementation is turned on).
#include "simdjson/internal/isadetection.h"
#include "simdjson/internal/jsoncharutils_tables.h"
#include "simdjson/internal/numberparsing_tables.h"
#include "simdjson/internal/simdprune_tables.h"
#endif // SIMDJSON_IMPLEMENTATION_BASE_H

View File

@ -1,21 +1,57 @@
#ifndef SIMDJSON_IMPLEMENTATIONS_H
#define SIMDJSON_IMPLEMENTATIONS_H
// Implementation-internal files (must be included before the implementations themselves, to keep
// amalgamation working--otherwise, the first time a file is included, it might be put inside the
// #ifdef SIMDJSON_IMPLEMENTATION_ARM64/FALLBACK/etc., which means the other implementations can't
// compile unless that implementation is turned on).
#include "simdjson/internal/isadetection.h"
#include "simdjson/internal/jsoncharutils_tables.h"
#include "simdjson/internal/numberparsing_tables.h"
#include "simdjson/internal/simdprune_tables.h"
#include "simdjson/implementation-base.h"
//
// First, figure out which implementations can be run. Doing it here makes it so we don't have to worry about the order
// in which we include them.
//
#ifndef SIMDJSON_IMPLEMENTATION_ARM64
#define SIMDJSON_IMPLEMENTATION_ARM64 (SIMDJSON_IS_ARM64)
#endif
#define SIMDJSON_CAN_ALWAYS_RUN_ARM64 SIMDJSON_IMPLEMENTATION_ARM64 && SIMDJSON_IS_ARM64
// Default Haswell to on if this is x86-64. Even if we're not compiled for it, it could be selected
// at runtime.
#ifndef SIMDJSON_IMPLEMENTATION_HASWELL
#define SIMDJSON_IMPLEMENTATION_HASWELL (SIMDJSON_IS_X86_64)
#endif
// To see why (__BMI__) && (__PCLMUL__) && (__LZCNT__) are not part of this next line, see
// https://github.com/simdjson/simdjson/issues/1247
#define SIMDJSON_CAN_ALWAYS_RUN_HASWELL ((SIMDJSON_IMPLEMENTATION_HASWELL) && (SIMDJSON_IS_X86_64) && (__AVX2__))
// Default Westmere to on if this is x86-64, unless we'll always select Haswell.
#ifndef SIMDJSON_IMPLEMENTATION_WESTMERE
#define SIMDJSON_IMPLEMENTATION_WESTMERE (SIMDJSON_IS_X86_64 && !SIMDJSON_REQUIRES_HASWELL)
#endif
#define SIMDJSON_CAN_ALWAYS_RUN_WESTMERE (SIMDJSON_IMPLEMENTATION_WESTMERE && SIMDJSON_IS_X86_64 && __SSE4_2__ && __PCLMUL__)
#ifndef SIMDJSON_IMPLEMENTATION_PPC64
#define SIMDJSON_IMPLEMENTATION_PPC64 (SIMDJSON_IS_PPC64)
#endif
#define SIMDJSON_CAN_ALWAYS_RUN_PPC64 SIMDJSON_IMPLEMENTATION_PPC64 && SIMDJSON_IS_PPC64
// Default Fallback to on unless a builtin implementation has already been selected.
#ifndef SIMDJSON_IMPLEMENTATION_FALLBACK
#define SIMDJSON_IMPLEMENTATION_FALLBACK 1 // (!SIMDJSON_CAN_ALWAYS_RUN_ARM64 && !SIMDJSON_CAN_ALWAYS_RUN_HASWELL && !SIMDJSON_CAN_ALWAYS_RUN_WESTMERE && !SIMDJSON_CAN_ALWAYS_RUN_PPC64)
#endif
#define SIMDJSON_CAN_ALWAYS_RUN_FALLBACK SIMDJSON_IMPLEMENTATION_FALLBACK
SIMDJSON_PUSH_DISABLE_WARNINGS
SIMDJSON_DISABLE_UNDESIRED_WARNINGS
// Implementations
#include "simdjson/arm64.h"
#include "simdjson/haswell.h"
#include "simdjson/westmere.h"
#include "simdjson/ppc64.h"
#include "simdjson/fallback.h"
#include "simdjson/haswell.h"
#include "simdjson/ppc64.h"
#include "simdjson/westmere.h"
// Builtin implementation
#include "simdjson/builtin.h"
SIMDJSON_POP_DISABLE_WARNINGS
#endif // SIMDJSON_IMPLEMENTATIONS_H

View File

@ -1,7 +1,7 @@
#ifndef SIMDJSON_INTERNAL_JSONCHARUTILS_TABLES_H
#define SIMDJSON_INTERNAL_JSONCHARUTILS_TABLES_H
#include "simdjson.h"
#include "simdjson/common_defs.h"
#ifdef JSON_TEST_STRINGS
void found_string(const uint8_t *buf, const uint8_t *parsed_begin,

View File

@ -1,7 +1,7 @@
#ifndef SIMDJSON_INTERNAL_NUMBERPARSING_TABLES_H
#define SIMDJSON_INTERNAL_NUMBERPARSING_TABLES_H
#include "simdjson.h"
#include "simdjson/base.h"
namespace simdjson {
namespace internal {

View File

@ -1,22 +1,7 @@
#ifndef SIMDJSON_PPC64_H
#define SIMDJSON_PPC64_H
#ifdef SIMDJSON_FALLBACK_H
#error "ppc64.h must be included before fallback.h"
#endif
#include "simdjson/portability.h"
#ifndef SIMDJSON_IMPLEMENTATION_PPC64
#define SIMDJSON_IMPLEMENTATION_PPC64 (SIMDJSON_IS_PPC64)
#endif
#define SIMDJSON_CAN_ALWAYS_RUN_PPC64 SIMDJSON_IMPLEMENTATION_PPC64 && SIMDJSON_IS_PPC64
#include "simdjson/internal/isadetection.h"
#include "simdjson/internal/jsoncharutils_tables.h"
#include "simdjson/internal/numberparsing_tables.h"
#include "simdjson/internal/simdprune_tables.h"
#include "simdjson/implementation-base.h"
#if SIMDJSON_IMPLEMENTATION_PPC64
@ -42,12 +27,6 @@ namespace ppc64 {
#include "simdjson/generic/atomparsing.h"
#include "simdjson/ppc64/stringparsing.h"
#include "simdjson/ppc64/numberparsing.h"
#include "simdjson/generic/implementation_simdjson_result_base.h"
#include "simdjson/generic/ondemand.h"
// Inline definitions
#include "simdjson/generic/implementation_simdjson_result_base-inl.h"
#include "simdjson/generic/ondemand-inl.h"
#include "simdjson/ppc64/end.h"
#endif // SIMDJSON_IMPLEMENTATION_PPC64

View File

@ -1,7 +1,7 @@
#ifndef SIMDJSON_PPC64_IMPLEMENTATION_H
#define SIMDJSON_PPC64_IMPLEMENTATION_H
#include "simdjson.h"
#include "simdjson/base.h"
#include "simdjson/internal/isadetection.h"
namespace simdjson {

View File

@ -1,7 +1,7 @@
#ifndef SIMDJSON_PPC64_INTRINSICS_H
#define SIMDJSON_PPC64_INTRINSICS_H
#include "simdjson.h"
#include "simdjson/base.h"
// This should be the correct header whether
// you use visual studio or other compilers.

View File

@ -1,7 +1,7 @@
#ifndef SIMDJSON_PPC64_SIMD_H
#define SIMDJSON_PPC64_SIMD_H
#include "simdjson.h"
#include "simdjson/base.h"
#include "simdjson/internal/simdprune_tables.h"
#include "simdjson/ppc64/bitmanipulation.h"
#include <type_traits>

View File

@ -1,7 +1,7 @@
#ifndef SIMDJSON_PPC64_STRINGPARSING_H
#define SIMDJSON_PPC64_STRINGPARSING_H
#include "simdjson.h"
#include "simdjson/base.h"
#include "simdjson/ppc64/bitmanipulation.h"
#include "simdjson/ppc64/simd.h"

View File

@ -1,21 +1,17 @@
#ifndef SIMDJSON_WESTMERE_H
#define SIMDJSON_WESTMERE_H
#ifdef SIMDJSON_FALLBACK_H
#error "westmere.h must be included before fallback.h"
#endif
#include "simdjson/portability.h"
// Default Westmere to on if this is x86-64, unless we'll always select Haswell.
#ifndef SIMDJSON_IMPLEMENTATION_WESTMERE
#define SIMDJSON_IMPLEMENTATION_WESTMERE (SIMDJSON_IS_X86_64 && !SIMDJSON_REQUIRES_HASWELL)
#endif
#define SIMDJSON_CAN_ALWAYS_RUN_WESTMERE (SIMDJSON_IMPLEMENTATION_WESTMERE && SIMDJSON_IS_X86_64 && __SSE4_2__ && __PCLMUL__)
#include "simdjson/implementation-base.h"
#if SIMDJSON_IMPLEMENTATION_WESTMERE
#if SIMDJSON_CAN_ALWAYS_RUN_WESTMERE
#define SIMDJSON_TARGET_WESTMERE
#define SIMDJSON_UNTARGET_WESTMERE
#else
#define SIMDJSON_TARGET_WESTMERE SIMDJSON_TARGET_REGION("sse4.2,pclmul")
#define SIMDJSON_UNTARGET_WESTMERE SIMDJSON_UNTARGET_REGION
#endif
namespace simdjson {
/**
@ -26,7 +22,7 @@ namespace westmere {
} // namespace simdjson
//
// These two need to be included outside SIMDJSON_TARGET_REGION
// These two need to be included outside SIMDJSON_TARGET_WESTMERE
//
#include "simdjson/westmere/implementation.h"
#include "simdjson/westmere/intrinsics.h"
@ -45,13 +41,6 @@ namespace westmere {
#include "simdjson/generic/atomparsing.h"
#include "simdjson/westmere/stringparsing.h"
#include "simdjson/westmere/numberparsing.h"
#include "simdjson/generic/implementation_simdjson_result_base.h"
#include "simdjson/generic/ondemand.h"
// Inline definitions
#include "simdjson/generic/implementation_simdjson_result_base-inl.h"
#include "simdjson/generic/ondemand-inl.h"
#include "simdjson/westmere/end.h"
#endif // SIMDJSON_IMPLEMENTATION_WESTMERE

View File

@ -1,2 +1,2 @@
SIMDJSON_UNTARGET_REGION
SIMDJSON_UNTARGET_WESTMERE
#undef SIMDJSON_IMPLEMENTATION

View File

@ -3,7 +3,7 @@
#include "simdjson/implementation.h"
// The constructor may be executed on any host, so we take care not to use SIMDJSON_TARGET_REGION
// The constructor may be executed on any host, so we take care not to use SIMDJSON_TARGET_WESTMERE
namespace simdjson {
namespace westmere {

View File

@ -83,7 +83,8 @@ def dofile(fid, prepath, filename):
# Last lines are always ignored. Files should end by an empty lines.
print(f"/* begin file {RELFILE} */", file=fid)
includepattern = re.compile('^#include "(.*)"')
redefines_simdjson_implementation = re.compile('^#define SIMDJSON_IMPLEMENTATION (.*)')
redefines_simdjson_implementation = re.compile('^#define\s+SIMDJSON_IMPLEMENTATION\s+(.*)')
undefines_simdjson_implementation = re.compile('^#undef\s+SIMDJSON_IMPLEMENTATION\s*$')
uses_simdjson_implementation = re.compile('SIMDJSON_IMPLEMENTATION([^_a-zA-Z0-9]|$)')
with open(file, 'r') as fid2:
for line in fid2:
@ -106,6 +107,9 @@ def dofile(fid, prepath, filename):
if s:
current_implementation=s.group(1)
print(f"// redefining SIMDJSON_IMPLEMENTATION to \"{current_implementation}\"\n// {line}", file=fid)
elif undefines_simdjson_implementation.search(line):
# Don't include #undef SIMDJSON_IMPLEMENTATION since we're handling it ourselves
print(f"// {line}")
else:
# copy the line, with SIMDJSON_IMPLEMENTATION replace to what it is currently defined to
print(uses_simdjson_implementation.sub(current_implementation+"\\1",line), file=fid)

View File

@ -1,4 +1,4 @@
#include "simdjson.h"
#include "simdjson/base.h"
#include <initializer_list>
namespace simdjson {
@ -155,6 +155,7 @@ simdjson_warn_unused bool validate_utf8(const char *buf, size_t len) noexcept {
const implementation * builtin_implementation() {
static const implementation * builtin_impl = available_implementations[STRINGIFY(SIMDJSON_BUILTIN_IMPLEMENTATION)];
assert(builtin_impl);
return builtin_impl;
}

View File

@ -1,4 +1,4 @@
#include "simdjson.h"
#include "simdjson/base.h"
namespace simdjson {
namespace internal {

View File

@ -1,4 +1,4 @@
#include "simdjson.h"
#include "simdjson/base.h"
namespace simdjson {
namespace internal {

View File

@ -1,4 +1,4 @@
#include "simdjson.h"
#include "simdjson/base.h"
namespace simdjson {
namespace internal {