From 3867ee71ed0d5186020c1a7fd274eb9aae9b4c38 Mon Sep 17 00:00:00 2001 From: John Keiser Date: Thu, 16 Jul 2020 13:05:59 -0700 Subject: [PATCH] Include files where they are used --- src/arm64/dom_parser_implementation.cpp | 13 ++----------- src/fallback/dom_parser_implementation.cpp | 3 --- src/generic/stage1/json_structural_indexer.h | 6 ++++++ src/generic/stage1/utf8_validator.h | 1 + src/generic/stage2/structural_parser.h | 3 +++ src/haswell/dom_parser_implementation.cpp | 11 +---------- src/westmere/dom_parser_implementation.cpp | 11 +---------- 7 files changed, 14 insertions(+), 34 deletions(-) diff --git a/src/arm64/dom_parser_implementation.cpp b/src/arm64/dom_parser_implementation.cpp index 448ffc5e..6d077ad5 100644 --- a/src/arm64/dom_parser_implementation.cpp +++ b/src/arm64/dom_parser_implementation.cpp @@ -104,13 +104,9 @@ really_inline simd8 must_be_2_3_continuation(const simd8 prev2, c } // namespace SIMDJSON_IMPLEMENTATION } // namespace simdjson -#include "generic/stage1/buf_block_reader.h" -#include "generic/stage1/json_string_scanner.h" -#include "generic/stage1/json_scanner.h" -#include "generic/stage1/json_minifier.h" -#include "generic/stage1/find_next_document_index.h" #include "generic/stage1/utf8_lookup4_algorithm.h" #include "generic/stage1/json_structural_indexer.h" +#include "generic/stage1/utf8_validator.h" // // Stage 2 @@ -118,9 +114,6 @@ really_inline simd8 must_be_2_3_continuation(const simd8 prev2, c #include "arm64/stringparsing.h" #include "arm64/numberparsing.h" -#include "generic/stage2/logger.h" -#include "generic/stage2/atomparsing.h" -#include "generic/stage2/structural_iterator.h" #include "generic/stage2/structural_parser.h" // @@ -150,8 +143,6 @@ WARN_UNUSED error_code dom_parser_implementation::stage1(const uint8_t *_buf, si return arm64::stage1::json_structural_indexer::index<64>(buf, len, *this, streaming); } -#include "generic/stage1/utf8_validator.h" - WARN_UNUSED bool implementation::validate_utf8(const char *buf, size_t len) const noexcept { return simdjson::arm64::stage1::generic_validate_utf8(buf,len); } @@ -165,4 +156,4 @@ WARN_UNUSED error_code dom_parser_implementation::parse(const uint8_t *_buf, siz } // namespace SIMDJSON_IMPLEMENTATION } // namespace simdjson -#include "arm64/end_implementation.h" \ No newline at end of file +#include "arm64/end_implementation.h" diff --git a/src/fallback/dom_parser_implementation.cpp b/src/fallback/dom_parser_implementation.cpp index 444ef69e..1df7d868 100644 --- a/src/fallback/dom_parser_implementation.cpp +++ b/src/fallback/dom_parser_implementation.cpp @@ -314,9 +314,6 @@ WARN_UNUSED bool implementation::validate_utf8(const char *buf, size_t len) cons // #include "fallback/stringparsing.h" #include "fallback/numberparsing.h" -#include "generic/stage2/logger.h" -#include "generic/stage2/atomparsing.h" -#include "generic/stage2/structural_iterator.h" #include "generic/stage2/structural_parser.h" namespace simdjson { diff --git a/src/generic/stage1/json_structural_indexer.h b/src/generic/stage1/json_structural_indexer.h index a2663fe8..c0883341 100644 --- a/src/generic/stage1/json_structural_indexer.h +++ b/src/generic/stage1/json_structural_indexer.h @@ -3,6 +3,12 @@ // We assume the file in which it is included already includes // "simdjson/stage1.h" (this simplifies amalgation) +#include "generic/stage1/buf_block_reader.h" +#include "generic/stage1/json_string_scanner.h" +#include "generic/stage1/json_scanner.h" +#include "generic/stage1/json_minifier.h" +#include "generic/stage1/find_next_document_index.h" + namespace simdjson { namespace SIMDJSON_IMPLEMENTATION { namespace stage1 { diff --git a/src/generic/stage1/utf8_validator.h b/src/generic/stage1/utf8_validator.h index 2851d793..5e50166e 100644 --- a/src/generic/stage1/utf8_validator.h +++ b/src/generic/stage1/utf8_validator.h @@ -1,6 +1,7 @@ namespace simdjson { namespace SIMDJSON_IMPLEMENTATION { namespace stage1 { + /** * Validates that the string is actual UTF-8. */ diff --git a/src/generic/stage2/structural_parser.h b/src/generic/stage2/structural_parser.h index adaa8913..52e2ffa3 100644 --- a/src/generic/stage2/structural_parser.h +++ b/src/generic/stage2/structural_parser.h @@ -4,6 +4,9 @@ // "simdjson/stage2.h" (this simplifies amalgation) #include "generic/stage2/tape_writer.h" +#include "generic/stage2/logger.h" +#include "generic/stage2/atomparsing.h" +#include "generic/stage2/structural_iterator.h" namespace simdjson { namespace SIMDJSON_IMPLEMENTATION { diff --git a/src/haswell/dom_parser_implementation.cpp b/src/haswell/dom_parser_implementation.cpp index 40c4256f..6e01afb5 100644 --- a/src/haswell/dom_parser_implementation.cpp +++ b/src/haswell/dom_parser_implementation.cpp @@ -69,22 +69,15 @@ really_inline simd8 must_be_2_3_continuation(const simd8 prev2, c } // namespace SIMDJSON_IMPLEMENTATION } // namespace simdjson -#include "generic/stage1/buf_block_reader.h" -#include "generic/stage1/json_string_scanner.h" -#include "generic/stage1/json_scanner.h" -#include "generic/stage1/json_minifier.h" -#include "generic/stage1/find_next_document_index.h" #include "generic/stage1/utf8_lookup4_algorithm.h" #include "generic/stage1/json_structural_indexer.h" +#include "generic/stage1/utf8_validator.h" // // Stage 2 // #include "haswell/stringparsing.h" #include "haswell/numberparsing.h" -#include "generic/stage2/logger.h" -#include "generic/stage2/atomparsing.h" -#include "generic/stage2/structural_iterator.h" #include "generic/stage2/structural_parser.h" // @@ -112,8 +105,6 @@ WARN_UNUSED error_code dom_parser_implementation::stage1(const uint8_t *_buf, si return haswell::stage1::json_structural_indexer::index<128>(_buf, _len, *this, streaming); } -#include "generic/stage1/utf8_validator.h" - WARN_UNUSED bool implementation::validate_utf8(const char *buf, size_t len) const noexcept { return simdjson::haswell::stage1::generic_validate_utf8(buf,len); } diff --git a/src/westmere/dom_parser_implementation.cpp b/src/westmere/dom_parser_implementation.cpp index 69fb7b9d..4192d2b9 100644 --- a/src/westmere/dom_parser_implementation.cpp +++ b/src/westmere/dom_parser_implementation.cpp @@ -74,22 +74,15 @@ really_inline simd8 must_be_2_3_continuation(const simd8 prev2, c } // namespace SIMDJSON_IMPLEMENTATION } // namespace simdjson -#include "generic/stage1/buf_block_reader.h" -#include "generic/stage1/json_string_scanner.h" -#include "generic/stage1/json_scanner.h" -#include "generic/stage1/json_minifier.h" -#include "generic/stage1/find_next_document_index.h" #include "generic/stage1/utf8_lookup4_algorithm.h" #include "generic/stage1/json_structural_indexer.h" +#include "generic/stage1/utf8_validator.h" // // Stage 2 // #include "westmere/stringparsing.h" #include "westmere/numberparsing.h" -#include "generic/stage2/logger.h" -#include "generic/stage2/atomparsing.h" -#include "generic/stage2/structural_iterator.h" #include "generic/stage2/structural_parser.h" // @@ -117,8 +110,6 @@ WARN_UNUSED error_code dom_parser_implementation::stage1(const uint8_t *_buf, si return westmere::stage1::json_structural_indexer::index<64>(_buf, _len, *this, streaming); } -#include "generic/stage1/utf8_validator.h" - WARN_UNUSED bool implementation::validate_utf8(const char *buf, size_t len) const noexcept { return simdjson::westmere::stage1::generic_validate_utf8(buf,len); }