From 24a185d26b6e508fea10e6c782b40d889174621b Mon Sep 17 00:00:00 2001 From: Pavel P Date: Mon, 20 Apr 2020 03:22:38 +0600 Subject: [PATCH] Amalgamate src/simdjson.cpp as-is amalgamation.sh shouldn't change contents of src/simdjson.cpp by forcing dmalloc.h that didn't exist in non-amalgamated version and shouldn't change order of includes by placing simdjson.h at the top fixes #739 --- singleheader/amalgamate.sh | 18 +++++++----------- src/simdjson.cpp | 6 ++++++ 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/singleheader/amalgamate.sh b/singleheader/amalgamate.sh index b03c12c7..475d7394 100755 --- a/singleheader/amalgamate.sh +++ b/singleheader/amalgamate.sh @@ -46,7 +46,7 @@ function doinclude() if [[ ! " ${found_includes[@]} " =~ " ${file} " ]]; then found_includes+=("$file") dofile $AMALGAMATE_INCLUDE_PATH $file - fi; + fi elif [ -f $AMALGAMATE_SOURCE_PATH/$file ]; then # generic includes are included multiple times if [[ "${file}" == *'generic/'*'.h' ]]; then @@ -73,10 +73,15 @@ function dofile() do if [[ "${line}" == '#include "'*'"'* ]]; then file=$(echo $line| cut -d'"' -f 2) + # include all from simdjson.cpp except simdjson.h + if [ "${file}" == "simdjson.h" ] && [ "${2}" == "simdjson.cpp" ]; then + echo "$line" + continue + fi if [[ "${file}" == '../'* ]]; then file=$(echo $file| cut -d'/' -f 2-) - fi; + fi # we explicitly include simdjson headers, one time each (unless they are generic, in which case multiple times is fine) doinclude $file $line @@ -108,15 +113,6 @@ echo "/* auto-generated on ${timestamp}. Do not edit! */" > ${AMAL_H} echo "Creating ${AMAL_C}..." echo "/* auto-generated on ${timestamp}. Do not edit! */" > ${AMAL_C} { - echo "#include \"simdjson.h\"" - - echo "" - echo "/* used for http://dmalloc.com/ Dmalloc - Debug Malloc Library */" - echo "#ifdef DMALLOC" - echo "#include \"dmalloc.h\"" - echo "#endif" - echo "" - for file in ${ALLCFILES}; do dofile $AMALGAMATE_SOURCE_PATH $file done diff --git a/src/simdjson.cpp b/src/simdjson.cpp index dcaee740..f3a88fdd 100644 --- a/src/simdjson.cpp +++ b/src/simdjson.cpp @@ -1,4 +1,10 @@ #include "simdjson.h" + +/* used for http://dmalloc.com/ Dmalloc - Debug Malloc Library */ +#ifdef DMALLOC +#include "dmalloc.h" +#endif + #include "error.cpp" #include "implementation.cpp" #include "stage1_find_marks.cpp"