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

ARC compliance and some fixes #491

Closed
wants to merge 1 commit into from

Conversation

cristiankocza-sv
Copy link

Removed all calls to [self init...] as they might cause undefined behavior under ARC.
Improved the class family testing for selectors that need to call retain.
Fixed a block not being copied problem.
Fixed a should receive expectation with Class arguments not passing the verification.

References:
http://clang.llvm.org/docs/AutomaticReferenceCounting.html#semantics-of-init
http://clang.llvm.org/docs/AutomaticReferenceCounting.html#method-families

Removed all calls to [self init...] as they might cause undefined behavior.
Improved the class family testing for selectors that need to call retain.
Fixed a block not being copied problem.
Fixed a should receive expectation with Class arguments not passing the verification.

References:
http://clang.llvm.org/docs/AutomaticReferenceCounting.html#semantics-of-init
http://clang.llvm.org/docs/AutomaticReferenceCounting.html#method-families
va_list argumentList;
va_start(argumentList, format);
NSString *aMessage = [[NSString alloc] initWithFormat:format arguments:argumentList];
return [self initWithCallSite:aCallSite message:aMessage];
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per clang documentation (http://clang.llvm.org/docs/AutomaticReferenceCounting.html#semantics-of-init):
It is undefined behavior for a program to cause two or more calls to init methods on the same object, except that each init method invocation may perform at most one delegate init call.

Thus, I removed all initializers that called other initializers, added convenience methods where appropriate.

@cristiankocza-sv
Copy link
Author

@supermarin can you review this and let me know if the changes are ok and if I should try to split them into multiple PRs?

@cristiankocza-sv
Copy link
Author

Can someone look to this PR? Due to the ARC naming conventions and the missing [block copy] call I get crashes in my unit tests if using the current code base, so I'm forced to use the 41bb6dd revision, which prevents me from using the latest Kiwi fixes (especially the "let" ones).

Thanks

@cristiankocza-sv
Copy link
Author

Closed this as some of the crashed got addressed in #517, by removing the fno-objc-arc flag for the corresponding files.

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

Successfully merging this pull request may close these issues.

1 participant