Skip to content

Companion PR to Swift #1157 and 32-bit bug fixes #249

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

Merged
merged 1 commit into from
Feb 18, 2016
Merged

Companion PR to Swift #1157 and 32-bit bug fixes #249

merged 1 commit into from
Feb 18, 2016

Conversation

hpux735
Copy link
Contributor

@hpux735 hpux735 commented Feb 2, 2016

This PR is a necessary companion to swiftlang/swift#1157 . swift.ld is used in the build of Foundation, and with the deletion of the script from Swift, Foundation fails to build. The first commit uses the conformance begin and end objects generated in Swift for manual share library linking. Also, this commit allows the Swift build scripts to indicate to Foundation whether it should use the gold linker.

It's very important that this PR only be merged at the same time as the Swift#1157

The second commit addresses some new regressions introduced in NSXML* on 32-bit systems. The NSXMLNodeOptionRawType type was introduced for working with NSXMLNodeOptions in a bit-width independent way.

@@ -62,7 +62,7 @@ public class NSXMLDTDNode : NSXMLNode {
}
} //primitive

public override init(kind: NSXMLNodeKind, options: Int) {
public override init(kind: NSXMLNodeKind, options: NSXMLNodeOptionRawType) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems like an API change. It is declared in both 32 bit and 64 bit Darwin targets as public convenience init(kind: NSXMLNodeKind, options: Int) why can't it be that here too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

To avoid changing the API, I can cast it to that type within the function if that's what you prefer. We've hit this problem before in #169 (comment) Ultimately, it seems like this stuff boils down to a CF type that resolves to UInt32. I kinda don't understand why it's promoted to a 64-bit int in Foundation.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think because NSUInteger and NSInteger were preferred for APIs for future proofing the storage size for parameters.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That makes sense. In that case, the type seems necessary. The reason being is that Int on 32-bit platforms is (as expected) a signed 32-bit integer. In NSXMLNodeOptions:105 the upper bits are set to '1' (including bit 31) which is an overflow in that case.

Because NSXMLNodeOptionRawType is a typealias to Int on 64-bit machines and Int64 on 32-bit machines Swift doesn't require casts (to my knowledge) on 64-bit. On 32-bit machines, it guarantees that NSXMLNodePreserveAll won't overflow (among other issues).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I went ahead and took this stuff out. It's probably not appropriate to mix these into the same PR. I'll make another one for the XML issues.

@phausler
Copy link
Contributor

phausler commented Feb 3, 2016

@swift-ci Please test

@phausler
Copy link
Contributor

phausler commented Feb 3, 2016

oh never mind swiftlang/swift#1157 is required to build; else we get

ninja: error: '/home/phausler/Public/build/Ninja-ReleaseAssert/swift-linux-x86_64/lib/swift/linux/x86_64/swift_begin.o', needed by '../build/Ninja-ReleaseAssert/foundation-linux-x86_64/Foundation/libFoundation.so', missing and no known rule to make it

@hpux735
Copy link
Contributor Author

hpux735 commented Feb 3, 2016

Yep that's right. We'll need to wait a bit. :) Here's the new PR that handles XML #252

@phausler
Copy link
Contributor

@swift-ci Please test

@gribozavr
Copy link
Contributor

@phausler It looks like we are going to merge swiftlang/swift#1157, would you mind us merging this PR as well, assuming all tests pass on Linux/x86_64?

@parkera
Copy link
Contributor

parkera commented Feb 15, 2016

I'm a little confused about why the XML change is required for this.

@hpux735
Copy link
Contributor Author

hpux735 commented Feb 15, 2016

@parkera Oops! It wasn't supposed to be there. The XML stuff was required for Foundation to build on ARM, so I pulled it in prior to Philippe merging it into master. I've removed it.

@parkera
Copy link
Contributor

parkera commented Feb 15, 2016

Ok, this makes more sense to me now. @gribozavr , if you test this and it works you can merge it in.

@gribozavr
Copy link
Contributor

@parkera Thanks! We're waiting for a companion PR for a similar build system change in xctest, but once that is ready, I'll merge all three PRs together.

gribozavr added a commit that referenced this pull request Feb 18, 2016
Companion PR to Swift #1157 and 32-bit bug fixes
@gribozavr gribozavr merged commit 557c7e5 into swiftlang:master Feb 18, 2016
atrick pushed a commit to atrick/swift-corelibs-foundation that referenced this pull request Jan 12, 2021
Add default value to DiagnosticRelatedInformation initializer
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.

4 participants