From 7ad4020829704c87460c29de2e7fe730ffdd157b Mon Sep 17 00:00:00 2001 From: John Keiser Date: Mon, 11 May 2020 23:24:00 -0700 Subject: [PATCH] Make main compilation chunks into .cpp files --- include/simdjson/inline/error.h | 3 ++- src/arm64/{stage1_find_marks.h => stage1.cpp} | 5 ---- src/arm64/{stage2_build_tape.h => stage2.cpp} | 0 src/error.cpp | 2 +- src/fallback/{stage1.h => stage1.cpp} | 5 ---- src/fallback/{stage2.h => stage2.cpp} | 5 ---- src/haswell/{stage1.h => stage1.cpp} | 5 ---- src/haswell/{stage2.h => stage2.cpp} | 5 ---- src/jsoncharutils.h | 6 +++++ src/simdjson.cpp | 19 ++++++++++++-- src/stage1_find_marks.cpp | 12 --------- src/stage2_build_tape.cpp | 25 ------------------- src/westmere/{stage1.h => stage1.cpp} | 5 ---- src/westmere/{stage2.h => stage2.cpp} | 4 --- 14 files changed, 26 insertions(+), 75 deletions(-) rename src/arm64/{stage1_find_marks.h => stage1.cpp} (97%) rename src/arm64/{stage2_build_tape.h => stage2.cpp} (100%) rename src/fallback/{stage1.h => stage1.cpp} (98%) rename src/fallback/{stage2.h => stage2.cpp} (79%) rename src/haswell/{stage1.h => stage1.cpp} (96%) rename src/haswell/{stage2.h => stage2.cpp} (80%) delete mode 100644 src/stage1_find_marks.cpp delete mode 100644 src/stage2_build_tape.cpp rename src/westmere/{stage1.h => stage1.cpp} (96%) rename src/westmere/{stage2.h => stage2.cpp} (80%) diff --git a/include/simdjson/inline/error.h b/include/simdjson/inline/error.h index 8f961ca17..eeb7db320 100644 --- a/include/simdjson/inline/error.h +++ b/include/simdjson/inline/error.h @@ -1,8 +1,9 @@ #ifndef SIMDJSON_INLINE_ERROR_H #define SIMDJSON_INLINE_ERROR_H -#include "simdjson/error.h" +#include #include +#include "simdjson/error.h" namespace simdjson { namespace internal { diff --git a/src/arm64/stage1_find_marks.h b/src/arm64/stage1.cpp similarity index 97% rename from src/arm64/stage1_find_marks.h rename to src/arm64/stage1.cpp index 62dcc4be0..926d368fc 100644 --- a/src/arm64/stage1_find_marks.h +++ b/src/arm64/stage1.cpp @@ -1,6 +1,3 @@ -#ifndef SIMDJSON_ARM64_STAGE1_H -#define SIMDJSON_ARM64_STAGE1_H - #include "simdjson.h" #include "arm64/bitmask.h" #include "arm64/simd.h" @@ -88,5 +85,3 @@ WARN_UNUSED error_code implementation::stage1(const uint8_t *buf, size_t len, pa } // namespace arm64 } // namespace simdjson - -#endif // SIMDJSON_ARM64_STAGE1_H diff --git a/src/arm64/stage2_build_tape.h b/src/arm64/stage2.cpp similarity index 100% rename from src/arm64/stage2_build_tape.h rename to src/arm64/stage2.cpp diff --git a/src/error.cpp b/src/error.cpp index 04661956e..7b857054b 100644 --- a/src/error.cpp +++ b/src/error.cpp @@ -1,4 +1,4 @@ -#include "simdjson/error.h" +#include "simdjson.h" namespace simdjson { namespace internal { diff --git a/src/fallback/stage1.h b/src/fallback/stage1.cpp similarity index 98% rename from src/fallback/stage1.h rename to src/fallback/stage1.cpp index 0d8f4813a..5f5be3c1d 100644 --- a/src/fallback/stage1.h +++ b/src/fallback/stage1.cpp @@ -1,6 +1,3 @@ -#ifndef SIMDJSON_FALLBACK_STAGE1_H -#define SIMDJSON_FALLBACK_STAGE1_H - #include "simdjson.h" #include "fallback/implementation.h" @@ -210,5 +207,3 @@ WARN_UNUSED error_code implementation::minify(const uint8_t *buf, size_t len, ui } // namespace fallback } // namespace simdjson - -#endif // SIMDJSON_FALLBACK_STAGE1_H diff --git a/src/fallback/stage2.h b/src/fallback/stage2.cpp similarity index 79% rename from src/fallback/stage2.h rename to src/fallback/stage2.cpp index f64f6dd8f..ad239ef5e 100644 --- a/src/fallback/stage2.h +++ b/src/fallback/stage2.cpp @@ -1,6 +1,3 @@ -#ifndef SIMDJSON_FALLBACK_STAGE2_H -#define SIMDJSON_FALLBACK_STAGE2_H - #include "simdjson.h" #include "fallback/implementation.h" @@ -17,5 +14,3 @@ namespace fallback { } // namespace fallback } // namespace simdjson - -#endif // SIMDJSON_FALLBACK_STAGE2_H diff --git a/src/haswell/stage1.h b/src/haswell/stage1.cpp similarity index 96% rename from src/haswell/stage1.h rename to src/haswell/stage1.cpp index e8c4922d0..01bf53f41 100644 --- a/src/haswell/stage1.h +++ b/src/haswell/stage1.cpp @@ -1,6 +1,3 @@ -#ifndef SIMDJSON_HASWELL_STAGE1_H -#define SIMDJSON_HASWELL_STAGE1_H - #include "simdjson.h" #include "haswell/bitmask.h" @@ -79,5 +76,3 @@ WARN_UNUSED error_code implementation::stage1(const uint8_t *buf, size_t len, pa } // namespace simdjson UNTARGET_REGION - -#endif // SIMDJSON_HASWELL_STAGE1_H diff --git a/src/haswell/stage2.h b/src/haswell/stage2.cpp similarity index 80% rename from src/haswell/stage2.h rename to src/haswell/stage2.cpp index 03d95f7d6..a7cea3da5 100644 --- a/src/haswell/stage2.h +++ b/src/haswell/stage2.cpp @@ -1,6 +1,3 @@ -#ifndef SIMDJSON_HASWELL_STAGE2_H -#define SIMDJSON_HASWELL_STAGE2_H - #include "simdjson.h" #include "haswell/implementation.h" #include "haswell/stringparsing.h" @@ -18,5 +15,3 @@ namespace haswell { } // namespace haswell } // namespace simdjson UNTARGET_REGION - -#endif // SIMDJSON_HASWELL_STAGE2_H diff --git a/src/jsoncharutils.h b/src/jsoncharutils.h index bf620dfc9..407e5d1c9 100644 --- a/src/jsoncharutils.h +++ b/src/jsoncharutils.h @@ -3,6 +3,12 @@ #include "simdjson.h" +#ifdef JSON_TEST_STRINGS +void found_string(const uint8_t *buf, const uint8_t *parsed_begin, + const uint8_t *parsed_end); +void found_bad_string(const uint8_t *buf); +#endif + namespace simdjson { // structural chars here are // they are { 0x7b } 0x7d : 0x3a [ 0x5b ] 0x5d , 0x2c (and NULL) diff --git a/src/simdjson.cpp b/src/simdjson.cpp index d98a8acbb..7e0f53be5 100644 --- a/src/simdjson.cpp +++ b/src/simdjson.cpp @@ -5,7 +5,22 @@ SIMDJSON_DISABLE_UNDESIRED_WARNINGS #include "error.cpp" #include "implementation.cpp" -#include "stage1_find_marks.cpp" -#include "stage2_build_tape.cpp" + +#if SIMDJSON_IMPLEMENTATION_ARM64 +#include "arm64/stage1.cpp" +#include "arm64/stage2.cpp" +#endif +#if SIMDJSON_IMPLEMENTATION_FALLBACK +#include "fallback/stage1.cpp" +#include "fallback/stage2.cpp" +#endif +#if SIMDJSON_IMPLEMENTATION_HASWELL +#include "haswell/stage1.cpp" +#include "haswell/stage2.cpp" +#endif +#if SIMDJSON_IMPLEMENTATION_WESTMERE +#include "westmere/stage1.cpp" +#include "westmere/stage2.cpp" +#endif SIMDJSON_POP_DISABLE_WARNINGS diff --git a/src/stage1_find_marks.cpp b/src/stage1_find_marks.cpp deleted file mode 100644 index 7571d9eea..000000000 --- a/src/stage1_find_marks.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#if SIMDJSON_IMPLEMENTATION_ARM64 -#include "arm64/stage1.h" -#endif -#if SIMDJSON_IMPLEMENTATION_FALLBACK -#include "fallback/stage1.h" -#endif -#if SIMDJSON_IMPLEMENTATION_HASWELL -#include "haswell/stage1.h" -#endif -#if SIMDJSON_IMPLEMENTATION_WESTMERE -#include "westmere/stage1.h" -#endif diff --git a/src/stage2_build_tape.cpp b/src/stage2_build_tape.cpp deleted file mode 100644 index 36f462cac..000000000 --- a/src/stage2_build_tape.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#include "simdjson.h" -#include -#include -#include "jsoncharutils.h" - -using namespace simdjson; - -#ifdef JSON_TEST_STRINGS -void found_string(const uint8_t *buf, const uint8_t *parsed_begin, - const uint8_t *parsed_end); -void found_bad_string(const uint8_t *buf); -#endif - -#if SIMDJSON_IMPLEMENTATION_ARM64 -#include "arm64/stage2.h" -#endif -#if SIMDJSON_IMPLEMENTATION_FALLBACK -#include "fallback/stage2.h" -#endif -#if SIMDJSON_IMPLEMENTATION_HASWELL -#include "haswell/stage2.h" -#endif -#if SIMDJSON_IMPLEMENTATION_WESTMERE -#include "westmere/stage2.h" -#endif diff --git a/src/westmere/stage1.h b/src/westmere/stage1.cpp similarity index 96% rename from src/westmere/stage1.h rename to src/westmere/stage1.cpp index e61c16860..e14ec4553 100644 --- a/src/westmere/stage1.h +++ b/src/westmere/stage1.cpp @@ -1,6 +1,3 @@ -#ifndef SIMDJSON_WESTMERE_STAGE1_H -#define SIMDJSON_WESTMERE_STAGE1_H - #include "simdjson.h" #include "westmere/bitmask.h" #include "westmere/simd.h" @@ -78,5 +75,3 @@ WARN_UNUSED error_code implementation::stage1(const uint8_t *buf, size_t len, pa } // namespace simdjson UNTARGET_REGION - -#endif // SIMDJSON_WESTMERE_STAGE1_H diff --git a/src/westmere/stage2.h b/src/westmere/stage2.cpp similarity index 80% rename from src/westmere/stage2.h rename to src/westmere/stage2.cpp index 71438ce72..7f9b43908 100644 --- a/src/westmere/stage2.h +++ b/src/westmere/stage2.cpp @@ -1,6 +1,3 @@ -#ifndef SIMDJSON_WESTMERE_STAGE2_H -#define SIMDJSON_WESTMERE_STAGE2_H - #include "simdjson.h" #include "westmere/implementation.h" #include "westmere/stringparsing.h" @@ -18,4 +15,3 @@ namespace westmere { } // namespace westmere } // namespace simdjson UNTARGET_REGION -#endif // SIMDJSON_WESTMERE_STAGE2_H