Skip to content

[CoreFoundation] Replace use of strlcpy/strlcat with our own functions. #5113

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
Oct 18, 2024

Conversation

al45tair
Copy link
Contributor

These can use strlcpy and strlcat if we have them, but we mustn't go defining strlcpy or strlcat because (a) those names are reserved, and (b) doing so without explicitly testing for their presence runs the risk of build failures from trying to define them when they already exist.

rdar://137567627

@al45tair
Copy link
Contributor Author

@swift-ci Please test Linux platform

@al45tair
Copy link
Contributor Author

@swift-ci Please test Windows platform

@parkera
Copy link
Contributor

parkera commented Oct 17, 2024

We need the Windows build to pass, though...

@parkera
Copy link
Contributor

parkera commented Oct 17, 2024

C:/Users/swift-ci/jenkins/workspace/swift-corelibs-foundation-PR-windows/swift-corelibs-foundation/Sources/CoreFoundation/internalInclude/CoreFoundation_Prefix.h(203,68): error: function-like macro '__GLIBC_PREREQ' is not defined
  203 | #if TARGET_OS_MAC || TARGET_OS_WASI || (defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 38))
      |                                                                    ^

@parkera parkera self-requested a review October 17, 2024 17:29
@al45tair
Copy link
Contributor Author

Oops, yes, that's wrong. Will fix and re-spin the tests.

These can _use_ `strlcpy` and `strlcat` if we have them, but we mustn't
go defining `strlcpy` or `strlcat` because (a) those names are reserved,
and (b) doing so without explicitly testing for their presence runs the
risk of build failures from trying to define them when they already
exist.

rdar://137567627
@al45tair
Copy link
Contributor Author

@swift-ci Please test Linux platform

@al45tair
Copy link
Contributor Author

@swift-ci Please test Windows platform

@al45tair
Copy link
Contributor Author

Hopefully fixed that one. That'll teach me to try to be clever and use the nice macro (the problem being that, of course, you can't use function macros in an expression if they're undefined, even after testing whether they're defined and doing an &&).

@al45tair
Copy link
Contributor Author

@swift-ci Please test Windows platform

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