diff --git a/include/simdjson.h b/include/simdjson.h index a52e9ce00..7dc03d09f 100644 --- a/include/simdjson.h +++ b/include/simdjson.h @@ -72,6 +72,15 @@ SIMDJSON_DISABLE_UNDESIRED_WARNINGS #include "simdjson/internal/tape_ref-inl.h" #include "simdjson/dom/serialization-inl.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" + // Implementations #include "simdjson/arm64.h" #include "simdjson/fallback.h" diff --git a/singleheader/amalgamate.sh b/singleheader/amalgamate.sh index 5dd8c5916..065bd091f 100755 --- a/singleheader/amalgamate.sh +++ b/singleheader/amalgamate.sh @@ -46,7 +46,15 @@ function doinclude() file=$1 line="${@:2}" if [ -f $AMALGAMATE_INCLUDE_PATH/$file ]; then - if [[ ! " ${found_includes[@]} " =~ " ${file} " ]]; then + # generic includes are included multiple times + if [[ "${file}" == *'generic/'*'.h' ]]; then + dofile $AMALGAMATE_INCLUDE_PATH $file + # begin/end_implementation are also included multiple times + elif [[ "${file}" == *'/begin.h' ]]; then + dofile $AMALGAMATE_INCLUDE_PATH $file + elif [[ "${file}" == *'/end.h' ]]; then + dofile $AMALGAMATE_INCLUDE_PATH $file + elif [[ ! " ${found_includes[@]} " =~ " ${file} " ]]; then found_includes+=("$file") dofile $AMALGAMATE_INCLUDE_PATH $file fi @@ -54,11 +62,6 @@ function doinclude() # generic includes are included multiple times if [[ "${file}" == *'generic/'*'.h' ]]; then dofile $AMALGAMATE_SOURCE_PATH $file - # begin/end_implementation are also included multiple times - elif [[ "${file}" == *'begin_implementation.h' ]]; then - dofile $AMALGAMATE_SOURCE_PATH $file - elif [[ "${file}" == *'end_implementation.h' ]]; then - dofile $AMALGAMATE_SOURCE_PATH $file elif [[ ! " ${found_includes[@]} " =~ " ${file} " ]]; then found_includes+=("$file") dofile $AMALGAMATE_SOURCE_PATH $file