Skip to content

[stdlib] adds nullability type specifier to NSStringGetCStringTrampoline #20835

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

Conversation

nordicio
Copy link
Contributor

Adds missing nullability specifier to the buffer passed to _swift_stdlib_NSStringGetCStringTrampoline.

Output from building from scratch on macOS 10.14.1 with the toolchain from Xcode 10.1 (10B61).

[108/1619] Building CXX object stdlib/...cosx-x86_64.dir/FoundationHelpers.mm.o
In file included from <path>swift/stdlib/public/stubs/FoundationHelpers.mm:23:
<path>swift/stdlib/public/stubs/../SwiftShims/CoreFoundationShims.h:137:61: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
                                         _swift_shims_UInt8 *buffer,
                                                            ^
<path>swift/stdlib/public/stubs/../SwiftShims/CoreFoundationShims.h:137:61: note: insert '_Nullable' if the pointer may be null
                                         _swift_shims_UInt8 *buffer,
                                                            ^
                                                              _Nullable 
<path>swift/stdlib/public/stubs/../SwiftShims/CoreFoundationShims.h:137:61: note: insert '_Nonnull' if the pointer should never be null
                                         _swift_shims_UInt8 *buffer,
                                                            ^
                                                              _Nonnull 
1 warning generated.

According to documentation and auto-completion in Xcode this pointer should be _Nonnull:

[@"" getCString:(nonnull char *) maxLength:(NSUInteger) encoding:(NSStringEncoding)];

Copy link
Contributor

@Catfish-Man Catfish-Man left a comment

Choose a reason for hiding this comment

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

Yup, thanks for catching this! Unclear how it compiled when I landed that >.<

@Catfish-Man
Copy link
Contributor

@swift-ci please test and merge

@Catfish-Man Catfish-Man self-assigned this Nov 29, 2018
@Catfish-Man
Copy link
Contributor

@swift-ci please test and merge

@compnerd
Copy link
Member

@swift-ci please test Linux platform

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 452230a

@nordicio
Copy link
Contributor Author

/usr/bin/ld.gold: error: /home/buildnode/jenkins/workspace/swift-PR-Linux/branch-master/buildbot_linux/none-swift_package_sandbox_linux-x86_64/usr/lib/swift_static/linux/libdispatch.a(apply.c.o): requires unsupported dynamic reloc 11; recompile with -fPIC

🤔 Not sure what to do about that?

@harlanhaskins
Copy link
Contributor

@swift-ci please test Linux platform

@harlanhaskins
Copy link
Contributor

Tests pass on macOS and Linux.

@harlanhaskins harlanhaskins merged commit 01bfdc1 into swiftlang:master Nov 30, 2018
@harlanhaskins
Copy link
Contributor

Thanks @nordicio!

@nordicio
Copy link
Contributor Author

nordicio commented Dec 1, 2018

Thank you, @harlanhaskins and @Catfish-Man :)

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.

5 participants