1 : #include "tests.h"
2 :
3 : /*
4 : * This test exercises the full, deliberately-exposed JSAPI interface to ensure
5 : * that no internal integer typedefs leak out. Include every intentionally
6 : * public header file (and those headers included by them, for completeness),
7 : * even the ones tests.h itself included, to verify this.
8 : */
9 : #include "js-config.h"
10 : #include "jsapi.h"
11 : #include "jsclass.h"
12 : #include "jscpucfg.h"
13 : #include "jspubtd.h"
14 : #include "jstypes.h"
15 : #include "jsval.h"
16 :
17 : #include "js/HashTable.h"
18 : #include "js/MemoryMetrics.h"
19 : #include "js/TemplateLib.h"
20 : #include "js/Utility.h"
21 : #include "js/Vector.h"
22 :
23 : /*
24 : * Verify that our public (and intended to be public, versus being that way
25 : * because we haven't made them private yet) headers don't define
26 : * {u,}int{8,16,32,64} or JS{Ui,I}nt{8,16,32,64} types. If any do, they will
27 : * assuredly conflict with a corresponding typedef below mapping to a *struct*.
28 : *
29 : * Note that tests.h includes a few internal headers; in order that this
30 : * jsapi-test be writable, those internal headers must not import the legacy
31 : * typedefs.
32 : */
33 :
34 : struct ConflictingType {
35 : uint64_t u64;
36 : };
37 :
38 : typedef ConflictingType uint8;
39 : typedef ConflictingType uint16;
40 : typedef ConflictingType uint32;
41 : typedef ConflictingType uint64;
42 :
43 : typedef ConflictingType int8;
44 : typedef ConflictingType int16;
45 : typedef ConflictingType int32;
46 : typedef ConflictingType int64;
47 :
48 : typedef ConflictingType JSUint8;
49 : typedef ConflictingType JSUint16;
50 : typedef ConflictingType JSUint32;
51 : typedef ConflictingType JSUint64;
52 :
53 : typedef ConflictingType JSInt8;
54 : typedef ConflictingType JSInt16;
55 : typedef ConflictingType JSInt32;
56 : typedef ConflictingType JSInt64;
57 :
58 : typedef ConflictingType jsword;
59 : typedef ConflictingType jsuword;
60 : typedef ConflictingType JSWord;
61 : typedef ConflictingType JSUword;
62 :
63 4 : BEGIN_TEST(testIntTypesABI)
64 : {
65 : /* This passes if the typedefs didn't conflict at compile time. */
66 1 : return true;
67 : }
68 2 : END_TEST(testIntTypesABI)
|