-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is the underlying BOOL type a bool on Apple silicon #110
Comments
I don't have an M1 myself, but cross-compiling the following code: // test_bool.m
#import <objc/objc.h>
BOOL BOOL_VALUE = 256;
_Bool C99_BOOL_VALUE = 256;
signed char SIGNED_CHAR_VALUE = 256;
char* BOOL_ = @encode(BOOL);
char* C99_BOOL = @encode(_Bool);
char* SIGNED_CHAR = @encode(signed char); With: $ clang -emit-llvm -S -target arm64-apple-darwin test_bool.m Yields: // Snippet
@BOOL_VALUE = global i8 1, align 1
@C99_BOOL_VALUE = global i8 1, align 1
@SIGNED_CHAR_VALUE = global i8 0, align 1
@.str = private unnamed_addr constant [2 x i8] c"B\00", align 1
@BOOL_ = global i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i32 0, i32 0), align 8
@C99_BOOL = global i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i32 0, i32 0), align 8
@.str.1 = private unnamed_addr constant [2 x i8] c"c\00", align 1
@SIGNED_CHAR = global i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i32 0, i32 0), align 8 Which strongly suggests that |
I think the problem is in your usage of delegate.add_ivar::<BOOL>(POWERED_ON_IVAR);
let powered_on = delegate.get_ivar::<BOOL>(POWERED_ON_IVAR);
delegate.set_ivar::<BOOL>(POWERED_ON_IVAR, YES); |
Thank you for your quick reply. Is there another step you're taking to compile the above test? Maybe including some headers or something? When I try I get this error:
|
Ah yes, sorry, I forgot to add an |
I made your suggested changes to bluster and it seems to pass tests, so maybe that's all it was! |
Also it looks like the llvm output is in fact the same on my machine as what you posted. Thank you for the investigation! |
I was confused about this library's definition of
BOOL
until finding this comment on SO, which explains thatBOOL
is a Csigned char
on Darwin and a Cbool
on iOS. I think we need to also check thetarget_os
to distinguish betweenaarch64-apple-darwin
andaarch64-apple-ios
, because I'm seeing odd errors when compilingbluster
dfrankland/bluster#44 on my M1 laptop.I will submit a patch if it ends up working.
The text was updated successfully, but these errors were encountered: