Skip to content
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

Closed
ngrewe opened this issue Sep 8, 2015 · 3 comments
Closed

Failing test in PropertyIntrospectionTest2 #5

ngrewe opened this issue Sep 8, 2015 · 3 comments

Comments

@ngrewe
Copy link
Member

ngrewe commented Sep 8, 2015

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 now T@,R,W,N,VidReadonlyWeakNonatomic. Since W 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?

@davidchisnall
Copy link
Member

I thought I'd fixed all of these. The correct fix is probably to accept either variant.

@ngrewe
Copy link
Member Author

ngrewe commented Sep 8, 2015

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.

@davidchisnall
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants