-
Notifications
You must be signed in to change notification settings - Fork 510
/
bool.c
49 lines (43 loc) · 912 Bytes
/
bool.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// TEST_CFLAGS -funsigned-char
// (verify -funsigned-char doesn't change the definition of BOOL)
#include "test.h"
#include <objc/objc.h>
#if TARGET_OS_OSX
# if __x86_64__
# define RealBool 0
# else
# define RealBool 1
# endif
#elif TARGET_OS_IOS || TARGET_OS_BRIDGE
# if (__arm__ && !__armv7k__) || __i386__
# define RealBool 0
# else
# define RealBool 1
# endif
#else
# define RealBool 1
#endif
#if __OBJC__ && !defined(__OBJC_BOOL_IS_BOOL)
# error no __OBJC_BOOL_IS_BOOL
#endif
#if RealBool != OBJC_BOOL_IS_BOOL
# error wrong OBJC_BOOL_IS_BOOL
#endif
#if RealBool == OBJC_BOOL_IS_CHAR
# error wrong OBJC_BOOL_IS_CHAR
#endif
int main()
{
const char *expected __unused =
#if RealBool
"B"
#else
"c"
#endif
;
#if __OBJC__
const char *enc = @encode(BOOL);
testassert(0 == strcmp(enc, expected));
#endif
succeed(__FILE__);
}