mirror of
https://github.com/darlinghq/darling-objc4.git
synced 2024-11-23 12:19:48 +00:00
50 lines
912 B
C
50 lines
912 B
C
// 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__);
|
|
}
|