Skip to content

[NFC-ish] Correct nullability of free() redeclaration #35399

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
Jan 14, 2021

Conversation

beccadax
Copy link
Contributor

LibcShims.h redeclares free() inside an "assume_nonnull" section, so this redeclaration's parameter is treated as _Nonnull.

With the clang currently used by the "main" branch, this mistake is harmless. With the clang in "next" and "rebranch", however, this redeclaration changes the optionality of free(_:)'s parameter when imported into Swift, which causes source compatibility failures in both the Swift test suite and downstream projects like llbuildSwift.

This PR adds a _Nonnull annotation to the redeclaration so that it imports as intended.

Fixes rdar://71269128. Note that some tests may fail unless a clean build is performed; I'm hoping the PR test provides a little clarity about this.

In the new clang, this declaration ends up influencing the redeclaration chain, altering the nullability of the `free(_:)` function imported into Swift.

Fixes rdar://71269128. Note that tests may fail unless a clean build is performed.
@beccadax
Copy link
Contributor Author

In #35391, I am testing whether this actually fixes the broken tests and allows llbuildSwift to be built on rebranch.

@beccadax
Copy link
Contributor Author

@swift-ci please smoke test

@beccadax
Copy link
Contributor Author

As detailed in #35391, PR testing on rebranch is failing due to unrelated bugs, but local testing indicates that this change will probably resolve the bug there.

@beccadax beccadax requested a review from xymus January 14, 2021 00:36
Copy link
Contributor

@xymus xymus left a comment

Choose a reason for hiding this comment

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

This looks good, thanks!

@beccadax beccadax merged commit 377a225 into swiftlang:main Jan 14, 2021
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.

2 participants