[swift-corelibs-dev] Defining _GNU_SOURCE for module-map-included headers

Pierre Habouzit pierre at habouzit.net
Mon Dec 21 13:06:42 CST 2015


> On Dec 21, 2015, at 11:00 AM, Jordan Rose <jordan_rose at apple.com> wrote:
> 
> 
>> On Dec 21, 2015, at 10:57 , Pierre Habouzit <pierre at habouzit.net <mailto:pierre at habouzit.net>> wrote:
>> 
>>> On Dec 21, 2015, at 9:34 AM, Jordan Rose via swift-corelibs-dev <swift-corelibs-dev at swift.org <mailto:swift-corelibs-dev at swift.org>> wrote:
>>> 
>>> Hm. If this is the right setting to set on everybody's system, we could add it as part of Clang initialization (for the Clang inside Swift). Otherwise, you can use "-Xcc" to pass extra flags to Clang, in this case "-Xcc -D_GNU_SOURCE=1”.
>> 
>> You definitely want -D_GNU_SOURCE=1 on linux systems, as all the non portable calls (that also are the interesting ones) will be hidden behind this.
> 
> Seems reasonable. If anyone wants to fix this, the relevant function is getNormalInvocationArguments <https://github.com/apple/swift/blob/master/lib/ClangImporter/ClangImporter.cpp#L265> in ClangImporter.cpp; otherwise, please file a bug report at https://bugs.swift.org <https://bugs.swift.org/>.
> 
> Thanks,
> Jordan

FWIW the effect of _GNU_SOURCE is documented in <features.h> on linux, and that’s also how you get 64bit vfs call (large file support) etc…
autotools give you _GNU_SOURCE by default usually e.g.

I double checked, _GNU_SOURCE is enough to get all the bits and pieces that you care about (at* calls, _BSD_SOURCE, etc…)

-Pierre
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-corelibs-dev/attachments/20151221/fc910a07/attachment.html>


More information about the swift-corelibs-dev mailing list