Skip to content

Add string.h for memcpy in Data.swift. #426

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

drodriguez
Copy link
Contributor

In Data.swift the C function memcpy is used as part of _copyBytesHelper.
The function is declared in string.h, but that header is not referenced
directly by any of the headers in dispatch/ or by DispatchOverlayShims.h
in the compiler, which are the only two headers imported by the swift
file.

For some reason, this is working on Darwin and Ubuntu, probably because
some included header includes string.h or declares memcpy, avoiding the
problem. For those platforms that this already works, adding an extra
include should not affect them.

In Data.swift the C function memcpy is used as part of _copyBytesHelper.
The function is defined in string.h, but that header is not referenced
directly by any of the headers in dispatch/ or by DispatchOverlayShims.h
in the compiler, which are the only two headers imported by the swift
file.

For some reason, this is working on Darwin and Ubuntu, probably because
some included header includes string.h or defines memcpy, avoiding the
problem. For those platforms that this already works, adding an extra
include should not affect them.
@ktopley-apple
Copy link
Contributor

@swift-ci please test

@ktopley-apple ktopley-apple merged commit 09ec354 into swiftlang:master Nov 9, 2018
@drodriguez drodriguez deleted the include-string-for-memcpy branch November 9, 2018 23:36
rokhinip pushed a commit that referenced this pull request Nov 5, 2021
Add string.h for memcpy in Data.swift.

Signed-off-by: Kim Topley <ktopley@apple.com>
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