Skip to content

Add objc_retainAutoreleasedReturnValue() #10355

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

Closed

Conversation

spevans
Copy link
Contributor

@spevans spevans commented Jun 17, 2017

  • This function has been duplicated in both swift-corelibs-libdispatch
    and swift-corelibs-foundation. Moving it to stdlib consolidates
    it and makes it available when not linking with Dispatch or
    Foundation.

  • Only required for non-Apple targets as the Objc Runtime provides
    the appropiate function on Apple targets.

This needs to be tested/merged at the same time as swiftlang/swift-corelibs-libdispatch#258 which removes it from libdispatch otherwise there will be a duplicate symbol when testing libdispatch.

Foundation will be fixed in a followup PR but shouldn't have a problem with duplicate symbols as it currently links using --allow-multiple-definition

- This function has been duplicated in both swift-corelibs-libdispatch
  and swift-corelibs-foundation. Moving it to stdlib consolidates
  it and makes it available when not linking with Dispatch or
  Foundation.

- Only required for non-Apple targets as the Objc Runtime provides
  the appropiate function on Apple targets.
@gottesmm
Copy link
Contributor

Are you sure that the right fix here isn't just to change the compiler?

@spevans
Copy link
Contributor Author

spevans commented Jun 18, 2017

@gottesmm That is probably the correct longterm fix and I was going to just alter it to emit a swift_retain instead of objc_retainAutoreleasedReturnValue however swift_retain doesn't return the original pointer. So I think any correct fix would require someone with more knowledge of the memory management.

Also I want to keep this change as simple as possible just to eliminate the duplicate symbols since it is a multi repo change, a better solution can be done in a followup PR.

@gottesmm
Copy link
Contributor

Ok. Can you file an SR for that so we can track that work?

@gottesmm
Copy link
Contributor

@swift-ci smoke test

@jckarter
Copy link
Contributor

I don't think we should do this; this is unnecessary churn and just defining the symbol is hiding serious bugs. We should fix the compiler.

@jckarter jckarter closed this Jun 19, 2017
@spevans
Copy link
Contributor Author

spevans commented Jun 20, 2017

I opened https://bugs.swift.org/browse/SR-5271 to track the correct fix.

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.

3 participants