|
1 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
2 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
4 |
|
5 /* |
|
6 * This test exercises the full, deliberately-exposed JSAPI interface to ensure |
|
7 * that no internal integer typedefs leak out. Include every intentionally |
|
8 * public header file (and those headers included by them, for completeness), |
|
9 * even the ones tests.h itself included, to verify this. |
|
10 */ |
|
11 |
|
12 #include "jscpucfg.h" |
|
13 #include "jspubtd.h" |
|
14 #include "jstypes.h" |
|
15 |
|
16 #include "js/Anchor.h" |
|
17 #include "js/CallArgs.h" |
|
18 #include "js/CallNonGenericMethod.h" |
|
19 #include "js/CharacterEncoding.h" |
|
20 #include "js/Class.h" |
|
21 #include "js/Date.h" |
|
22 #include "js/GCAPI.h" |
|
23 #include "js/HashTable.h" |
|
24 #include "js/HeapAPI.h" |
|
25 #include "js/Id.h" |
|
26 /* LegacyIntTypes.h is deliberately exempted from this requirement */ |
|
27 #include "js/MemoryMetrics.h" |
|
28 #include "js/OldDebugAPI.h" |
|
29 #include "js/ProfilingStack.h" |
|
30 #include "js/PropertyKey.h" |
|
31 #include "js/RequiredDefines.h" |
|
32 #include "js/RootingAPI.h" |
|
33 #include "js/SliceBudget.h" |
|
34 #include "js/StructuredClone.h" |
|
35 #include "js/TracingAPI.h" |
|
36 #include "js/TypeDecls.h" |
|
37 #include "js/Utility.h" |
|
38 #include "js/Value.h" |
|
39 #include "js/Vector.h" |
|
40 #include "js/WeakMapPtr.h" |
|
41 #include "jsapi-tests/tests.h" |
|
42 |
|
43 /* |
|
44 * Verify that our public (and intended to be public, versus being that way |
|
45 * because we haven't made them private yet) headers don't define |
|
46 * {u,}int{8,16,32,64} or JS{Ui,I}nt{8,16,32,64} types. If any do, they will |
|
47 * assuredly conflict with a corresponding typedef below mapping to a *struct*. |
|
48 * |
|
49 * Note that tests.h includes a few internal headers; in order that this |
|
50 * jsapi-test be writable, those internal headers must not import the legacy |
|
51 * typedefs. |
|
52 */ |
|
53 |
|
54 struct ConflictingType { |
|
55 uint64_t u64; |
|
56 }; |
|
57 |
|
58 typedef ConflictingType uint8; |
|
59 typedef ConflictingType uint16; |
|
60 typedef ConflictingType uint32; |
|
61 typedef ConflictingType uint64; |
|
62 |
|
63 typedef ConflictingType int8; |
|
64 typedef ConflictingType int16; |
|
65 typedef ConflictingType int32; |
|
66 typedef ConflictingType int64; |
|
67 |
|
68 typedef ConflictingType JSUint8; |
|
69 typedef ConflictingType JSUint16; |
|
70 typedef ConflictingType JSUint32; |
|
71 typedef ConflictingType JSUint64; |
|
72 |
|
73 typedef ConflictingType JSInt8; |
|
74 typedef ConflictingType JSInt16; |
|
75 typedef ConflictingType JSInt32; |
|
76 typedef ConflictingType JSInt64; |
|
77 |
|
78 typedef ConflictingType jsword; |
|
79 typedef ConflictingType jsuword; |
|
80 typedef ConflictingType JSWord; |
|
81 typedef ConflictingType JSUword; |
|
82 |
|
83 BEGIN_TEST(testIntTypesABI) |
|
84 { |
|
85 /* This passes if the typedefs didn't conflict at compile time. */ |
|
86 return true; |
|
87 } |
|
88 END_TEST(testIntTypesABI) |