Skip to content

Commit bb54946

Browse files
committed
Disallow including headers from implementation files
1 parent 4dec6ed commit bb54946

93 files changed

Lines changed: 73144 additions & 96426 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.clangd‎

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
CompileFlags:
22
CompilationDatabase: build
3+
Add:
4+
- -Wundefined-inline
35
Diagnostics:
46
Suppress:
57
- misc-unused-alias-decls
@@ -16,10 +18,28 @@ If:
1618
CompileFlags:
1719
Add:
1820
- -Wno-unneeded-internal-declaration
19-
- -Wno-undefined-inline # TODO fix and remove these violations
2021
- -Wno-undefined-internal # TODO fix and remove these violations
2122
- -Wno-unused-function
2223
- -Wno-unused-const-variable
2324
Diagnostics:
2425
Suppress:
2526
- pp_including_mainfile_in_preamble
27+
---
28+
# Amalgamated files that require or partly define an implementation
29+
If:
30+
PathMatch:
31+
- .*/(arm64|fallback|haswell|icelake|ppc64|westmere)/begin.h
32+
- .*/generic/.*
33+
Diagnostics:
34+
Suppress:
35+
- pragma_attribute_no_pop_eof
36+
---
37+
# clang has a bad time detecting the push/pop together in src/ for some reason
38+
If:
39+
PathMatch:
40+
- include/simdjson/.*/end.h
41+
- src/(arm64|fallback|haswell|icelake|ppc64|westmere).cpp
42+
Diagnostics:
43+
Suppress:
44+
- pragma_attribute_no_pop_eof
45+
- pragma_attribute_stack_mismatch

‎include/simdjson/arm64/base.h‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,4 @@ template <typename T> struct simd8x64;
2323
} // namespace arm64
2424
} // namespace simdjson
2525

26-
#ifndef SIMDJSON_AMALGAMATED
27-
// If we're editing one of the files in this directory, begin the implementation!
28-
#ifndef SIMDJSON_IMPLEMENTATION
29-
#include "simdjson/arm64/begin.h"
30-
#endif
31-
#endif // SIMDJSON_AMALGAMATED
32-
3326
#endif // SIMDJSON_ARM64_BASE_H

‎include/simdjson/arm64/bitmanipulation.h‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
#ifndef SIMDJSON_ARM64_BITMANIPULATION_H
22
#define SIMDJSON_ARM64_BITMANIPULATION_H
33

4+
#ifndef SIMDJSON_AMALGAMATED
45
#include "simdjson/arm64/base.h"
56
#include "simdjson/arm64/intrinsics.h"
7+
#endif // SIMDJSON_AMALGAMATED
68

79
namespace simdjson {
8-
namespace SIMDJSON_IMPLEMENTATION {
10+
namespace arm64 {
911
namespace {
1012

1113
// We sometimes call trailing_zero on inputs that are zero,
@@ -98,7 +100,7 @@ simdjson_inline bool add_overflow(uint64_t value1, uint64_t value2, uint64_t *re
98100
}
99101

100102
} // unnamed namespace
101-
} // namespace SIMDJSON_IMPLEMENTATION
103+
} // namespace arm64
102104
} // namespace simdjson
103105

104106
#endif // SIMDJSON_ARM64_BITMANIPULATION_H

‎include/simdjson/arm64/bitmask.h‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
#ifndef SIMDJSON_ARM64_BITMASK_H
22
#define SIMDJSON_ARM64_BITMASK_H
33

4+
#ifndef SIMDJSON_AMALGAMATED
45
#include "simdjson/arm64/base.h"
6+
#endif // SIMDJSON_AMALGAMATED
57

68
namespace simdjson {
7-
namespace SIMDJSON_IMPLEMENTATION {
9+
namespace arm64 {
810
namespace {
911

1012
//

‎include/simdjson/arm64/end.h‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1+
#ifndef SIMDJSON_AMALGAMATED
2+
#include "simdjson/arm64/base.h"
3+
#endif // SIMDJSON_AMALGAMATED
4+
15
#undef SIMDJSON_IMPLEMENTATION

‎include/simdjson/arm64/implementation.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#define SIMDJSON_ARM64_IMPLEMENTATION_H
33

44
#ifndef SIMDJSON_AMALGAMATED
5+
#include "simdjson/base.h"
56
#include "simdjson/implementation.h"
67
#include "simdjson/internal/instruction_set.h"
78
#endif // SIMDJSON_AMALGAMATED
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
#ifndef SIMDJSON_ARM64_INTRINSICS_H
22
#define SIMDJSON_ARM64_INTRINSICS_H
33

4+
#ifndef SIMDJSON_AMALGAMATED
5+
#include "simdjson/arm64/base.h"
6+
#endif // SIMDJSON_AMALGAMATED
7+
48
// This should be the correct header whether
59
// you use visual studio or other compilers.
610
#include <arm_neon.h>
711

8-
#include "simdjson/arm64/base.h"
9-
1012
static_assert(sizeof(uint8x16_t) <= simdjson::SIMDJSON_PADDING, "insufficient padding for arm64");
1113

1214
#endif // SIMDJSON_ARM64_INTRINSICS_H

‎include/simdjson/arm64/numberparsing_defs.h‎

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
11
#ifndef SIMDJSON_ARM64_NUMBERPARSING_DEFS_H
22
#define SIMDJSON_ARM64_NUMBERPARSING_DEFS_H
33

4+
#ifndef SIMDJSON_AMALGAMATED
45
#include "simdjson/arm64/base.h"
56
#include "simdjson/arm64/intrinsics.h"
7+
#include "simdjson/internal/numberparsing_tables.h"
8+
#endif // SIMDJSON_AMALGAMATED
9+
10+
#include <cstring>
611

712
#if _M_ARM64
813
// __umulh requires intrin.h
914
#include <intrin.h>
1015
#endif // _M_ARM64
1116

12-
#include <cstring>
13-
14-
#ifndef SIMDJSON_AMALGAMATED
15-
#include "simdjson/internal/numberparsing_tables.h"
16-
#endif // SIMDJSON_AMALGAMATED
17-
1817
namespace simdjson {
19-
namespace SIMDJSON_IMPLEMENTATION {
18+
namespace arm64 {
2019
namespace numberparsing {
2120

2221
// we don't have SSE, so let us use a scalar function
@@ -49,7 +48,7 @@ simdjson_inline internal::value128 full_multiplication(uint64_t value1, uint64_t
4948
}
5049

5150
} // namespace numberparsing
52-
} // namespace SIMDJSON_IMPLEMENTATION
51+
} // namespace arm64
5352
} // namespace simdjson
5453

5554
#define SIMDJSON_SWAR_NUMBER_PARSING 1

‎include/simdjson/arm64/simd.h‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
#ifndef SIMDJSON_ARM64_SIMD_H
22
#define SIMDJSON_ARM64_SIMD_H
33

4+
#ifndef SIMDJSON_AMALGAMATED
45
#include "simdjson/arm64/base.h"
56
#include "simdjson/arm64/bitmanipulation.h"
6-
7-
#ifndef SIMDJSON_AMALGAMATED
87
#include "simdjson/internal/simdprune_tables.h"
98
#endif // SIMDJSON_AMALGAMATED
109

1110
namespace simdjson {
12-
namespace SIMDJSON_IMPLEMENTATION {
11+
namespace arm64 {
1312
namespace {
1413
namespace simd {
1514

@@ -528,7 +527,7 @@ simdjson_inline int8x16_t make_int8x16_t(int8_t x1, int8_t x2, int8_t x3, int
528527

529528
} // namespace simd
530529
} // unnamed namespace
531-
} // namespace SIMDJSON_IMPLEMENTATION
530+
} // namespace arm64
532531
} // namespace simdjson
533532

534533
#endif // SIMDJSON_ARM64_SIMD_H

‎include/simdjson/arm64/stringparsing_defs.h‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
#ifndef SIMDJSON_ARM64_STRINGPARSING_DEFS_H
22
#define SIMDJSON_ARM64_STRINGPARSING_DEFS_H
33

4+
#ifndef SIMDJSON_AMALGAMATED
45
#include "simdjson/arm64/base.h"
56
#include "simdjson/arm64/simd.h"
67
#include "simdjson/arm64/bitmanipulation.h"
8+
#endif // SIMDJSON_AMALGAMATED
79

810
namespace simdjson {
9-
namespace SIMDJSON_IMPLEMENTATION {
11+
namespace arm64 {
1012
namespace {
1113

1214
using namespace simd;
@@ -45,7 +47,7 @@ simdjson_inline backslash_and_quote backslash_and_quote::copy_and_find(const uin
4547
}
4648

4749
} // unnamed namespace
48-
} // namespace SIMDJSON_IMPLEMENTATION
50+
} // namespace arm64
4951
} // namespace simdjson
5052

5153
#endif // SIMDJSON_ARM64_STRINGPARSING_DEFS_H

0 commit comments

Comments
 (0)