Fix amalgamation with generic/ files in include/

This commit is contained in:
John Keiser 2020-09-08 16:04:18 -07:00
parent baf6607e74
commit 3577c87c88
2 changed files with 18 additions and 6 deletions

View File

@ -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"

View File

@ -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