]>
Commit | Line | Data |
---|---|---|
13ba007e A |
1 | /* |
2 | TEST_CRASHES | |
3 | TEST_BUILD_OUTPUT | |
4 | .*badTagClass.m:\d+:\d+: warning: null passed to a callee that requires a non-null argument \[-Wnonnull\] | |
5 | END | |
6 | TEST_RUN_OUTPUT | |
7 | objc\[\d+\]: tag index 1 used for two different classes \(was 0x[0-9a-fA-F]+ NSObject, now 0x[0-9a-fA-F]+ TestRoot\) | |
8 | objc\[\d+\]: HALTED | |
9 | OR | |
10 | no tagged pointers | |
11 | OK: badTagClass.m | |
12 | END | |
13 | */ | |
14 | ||
15 | #include "test.h" | |
16 | #include "testroot.i" | |
17 | ||
18 | #include <objc/objc-internal.h> | |
19 | #include <objc/Protocol.h> | |
20 | ||
21 | #if OBJC_HAVE_TAGGED_POINTERS | |
22 | ||
23 | int main() | |
24 | { | |
25 | // re-registration and nil registration allowed | |
26 | _objc_registerTaggedPointerClass(OBJC_TAG_1, [NSObject class]); | |
27 | _objc_registerTaggedPointerClass(OBJC_TAG_1, [NSObject class]); | |
28 | _objc_registerTaggedPointerClass(OBJC_TAG_1, nil); | |
29 | _objc_registerTaggedPointerClass(OBJC_TAG_1, [NSObject class]); | |
30 | ||
31 | // colliding registration disallowed | |
32 | _objc_registerTaggedPointerClass(OBJC_TAG_1, [TestRoot class]); | |
33 | ||
34 | fail(__FILE__); | |
35 | } | |
36 | ||
37 | #else | |
38 | ||
39 | int main() | |
40 | { | |
41 | // provoke the same nullability warning as the real test | |
42 | objc_getClass(nil); | |
43 | ||
44 | fprintf(stderr, "no tagged pointers\n"); | |
45 | succeed(__FILE__); | |
46 | } | |
47 | ||
48 | #endif |