-
Notifications
You must be signed in to change notification settings - Fork 1.2k
asprintf exists on linux #3021
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
asprintf exists on linux #3021
Conversation
asprintf exists on linux for quite a while, 2015 at least. do use it.
@swift-ci test |
@spevans any updates? |
As per the discussion in #4610, So long as |
@swift-ci please test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be good to verify that _GNU_SOURCE
is being defined. I suspect that this might come back to hurt us a bit as not all libc implementation may provide this extension. Perhaps a comment at these sites makes sense to indicate that we are relying on the fact that we only support glibc (and bionic) and that they provide asprintf
(at least under some flags).
We do for Android in https://github.com/apple/swift/blob/0053526c5d15532ef38fcf72006a9e16840b92a0/lib/ClangImporter/ClangImporter.cpp#L682-L688 . There's a comment for why it is not enabled in Linux, so if you need it for every Linux, maybe it needs to be done manually before any |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm okay with merging this. We should probably add something like || (TARGET_OS_LINUX && !defined(_GNU_SOURCE))
just to completely cover the bases, but that can come in a subsequent patch.
Thanks for the contribution @soloturn! |
asprintf exists on linux for quite a while, 2015 at least. do use it.
fixes https://bugs.swift.org/browse/SR-14935