]> git.saurik.com Git - apple/objc4.git/blob - test/definitions.c
objc4-532.2.tar.gz
[apple/objc4.git] / test / definitions.c
1 // TEST_CONFIG
2
3 // DO NOT include anything else here
4 #include <objc/objc.h>
5 // DO NOT include anything else here
6 Class c = Nil;
7 SEL s;
8 IMP i;
9 id o = nil;
10 BOOL b = YES;
11 BOOL b2 = NO;
12 #if !__has_feature(objc_arr)
13 __strong void *p;
14 #endif
15 id __unsafe_unretained u;
16 id __weak w;
17
18 void fn(void) __unused;
19 void fn(void) {
20 id __autoreleasing a __unused;
21 }
22
23 #if __llvm__ && !__clang__
24 // llvm-gcc defines _NSConcreteGlobalBlock wrong
25 #else
26 // rdar://10118972 wrong type inference for blocks returning YES and NO
27 BOOL (^block1)(void) = ^{ return YES; };
28 BOOL (^block2)(void) = ^{ return NO; };
29 #endif
30
31 #include "test.h"
32
33 int main()
34 {
35 testassert(YES);
36 testassert(!NO);
37 testassert(!nil);
38 testassert(!Nil);
39
40 #if __has_feature(objc_bool)
41 // YES[array] is disallowed for objc just as true[array] is for C++
42 #else
43 // this will fail if YES and NO do not have enough parentheses
44 int array[2] = { 888, 999 };
45 testassert(NO[array] == 888);
46 testassert(YES[array] == 999);
47 #endif
48
49 succeed(__FILE__);
50 }