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
Failing test in PropertyIntrospectionTest2 #5
Comments
I thought I'd fixed all of these. The correct fix is probably to accept either variant. |
Actually, it get's a bit more weird: The weak annotation is present in the type signature but not in in the attributes2 member of the property structure. This is due to this code in CGObjCGNU.cpp: if (attrs & ObjCPropertyDecl::OBJC_PR_readonly) {
attrs &= ~ObjCPropertyDecl::OBJC_PR_copy;
attrs &= ~ObjCPropertyDecl::OBJC_PR_retain;
attrs &= ~ObjCPropertyDecl::OBJC_PR_weak;
attrs &= ~ObjCPropertyDecl::OBJC_PR_strong;
} Since the property is read only, the weak flag gets cleared. Behaviour with the Apple runtime is to keep the weak flags. |
This looks like a clang bug then. This code in clang is a bit horrible, because it was a quick hack to add property introspection the week before a release branched. For Clang 3.8 / libobjc2 2.0, I'm planing on introducing a new ABI that fix a number of these issues. For now, the best thing to do is make the libobjc2 tests permissive to expected clang values. |
I upgraded to clang 3.7 (from 3.4, I think) last night, and I'm now getting a test failure in PropertyIntrospectionTest2. The test expects
T@,R,N,VidReadonlyWeakNonatomic
, but what I get from the compiler (checked the binary) is nowT@,R,W,N,VidReadonlyWeakNonatomic
. SinceW
is the attribute char for weak properties, it seems to me that the test now expects the wrong thing (probably the weak attribute wasn't supported in earlier version of clang?).We could make this conditional on the compiler version, but maybe there is a feature check macro that can be used? Or maybe we just want the test to fail on earlier versions of clang?
The text was updated successfully, but these errors were encountered: