Skip to content

Commit 43a66a7

Browse files
committed
Fix amalgamation with generic/ files in include/
1 parent 8a92979 commit 43a66a7

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

include/simdjson.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,15 @@ SIMDJSON_DISABLE_UNDESIRED_WARNINGS
6969
#include "simdjson/dom/parser-inl.h"
7070
#include "simdjson/internal/tape_ref-inl.h"
7171

72+
// Implementation-internal files (must be included before the implementations themselves, to keep
73+
// amalgamation working--otherwise, the first time a file is included, it might be put inside the
74+
// #ifdef SIMDJSON_IMPLEMENTATION_ARM64/FALLBACK/etc., which means the other implementations can't
75+
// compile unless that implementation is turned on).
76+
#include "simdjson/internal/isadetection.h"
77+
#include "simdjson/internal/jsoncharutils_tables.h"
78+
#include "simdjson/internal/numberparsing_tables.h"
79+
#include "simdjson/internal/simdprune_tables.h"
80+
7281
// Implementations
7382
#include "simdjson/arm64.h"
7483
#include "simdjson/fallback.h"

singleheader/amalgamate.sh

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,19 +46,22 @@ function doinclude()
4646
file=$1
4747
line="${@:2}"
4848
if [ -f $AMALGAMATE_INCLUDE_PATH/$file ]; then
49-
if [[ ! " ${found_includes[@]} " =~ " ${file} " ]]; then
49+
# generic includes are included multiple times
50+
if [[ "${file}" == *'generic/'*'.h' ]]; then
51+
dofile $AMALGAMATE_INCLUDE_PATH $file
52+
# begin/end_implementation are also included multiple times
53+
elif [[ "${file}" == *'/begin.h' ]]; then
54+
dofile $AMALGAMATE_INCLUDE_PATH $file
55+
elif [[ "${file}" == *'/end.h' ]]; then
56+
dofile $AMALGAMATE_INCLUDE_PATH $file
57+
elif [[ ! " ${found_includes[@]} " =~ " ${file} " ]]; then
5058
found_includes+=("$file")
5159
dofile $AMALGAMATE_INCLUDE_PATH $file
5260
fi
5361
elif [ -f $AMALGAMATE_SOURCE_PATH/$file ]; then
5462
# generic includes are included multiple times
5563
if [[ "${file}" == *'generic/'*'.h' ]]; then
5664
dofile $AMALGAMATE_SOURCE_PATH $file
57-
# begin/end_implementation are also included multiple times
58-
elif [[ "${file}" == *'begin_implementation.h' ]]; then
59-
dofile $AMALGAMATE_SOURCE_PATH $file
60-
elif [[ "${file}" == *'end_implementation.h' ]]; then
61-
dofile $AMALGAMATE_SOURCE_PATH $file
6265
elif [[ ! " ${found_includes[@]} " =~ " ${file} " ]]; then
6366
found_includes+=("$file")
6467
dofile $AMALGAMATE_SOURCE_PATH $file

0 commit comments

Comments
 (0)