[swift-corelibs-libdispatch] Port transform and use libbsd (#13)


(Pierre Habouzit) #1

[…]
On a previous pull request, Daniel had requested we use #ifdef __APPLE__ instead of #if HAVE_MACH. Not sure if that also applies to this pull request too or if HAVE_MACH is ok to use in these files.

Hi,

I think this explanation is worth sharing and not leaving on an hidden review.
The pull request in question uses #if HAVE_MACH in .c files and internal headers where it’s possible to use HAVE_MACH because they see config.h and internal.h

It’s not ok to use this in public (or private headers, which is an OS X concept where we ship private APIs for sharing with other subsystems such as Foundation but aren’t generally useful or exposed as robust API: these entry points may change behavior or even not exist at all anymore from one release to the next) as we don’t ship config.h for relatively obvious reasons so HAVE_MACH is *not* defined there.

Technically, until someone ports libdispatch to GNU/Hurd,it’s okay to use #if __APPLE__ to hide anything mach related.

I hope I make sense.

-Pierre


(Chris Hanson) #2

I think it would be better not to conflate __APPLE__ and HAVE_MACH.

I don't expect a libdispatch port to OSF/1 any time soon, but libdispatch is already used in Jordan Hubbard's "NextBSD" effort, and that actually does provide Mach APIs without being an Apple platform.

  -- Chris

···

On Dec 14, 2015, at 8:12 PM, Pierre Habouzit via swift-corelibs-dev <swift-corelibs-dev@swift.org> wrote:

Technically, until someone ports libdispatch to GNU/Hurd,it’s okay to use #if __APPLE__ to hide anything mach related.


(Pierre Habouzit) #3

First we can't use HAVE_MACH which isn't namespaces in a system header. Second we don't want to ship configure.h either anyway.

Last we discussed with Daniel about that already and we'll probably end up having things based on __have_include() eventually. So for now __APPLE__ will do in headers. Everywhere else HAVE_MACH is used correctly as expected.

-Pierre on his iPhone

···

On 19 déc. 2015, at 13:11, Chris Hanson via swift-corelibs-dev <swift-corelibs-dev@swift.org> wrote:

On Dec 14, 2015, at 8:12 PM, Pierre Habouzit via swift-corelibs-dev <swift-corelibs-dev@swift.org> wrote:

Technically, until someone ports libdispatch to GNU/Hurd,it’s okay to use #if __APPLE__ to hide anything mach related.

I think it would be better not to conflate __APPLE__ and HAVE_MACH.

I don't expect a libdispatch port to OSF/1 any time soon, but libdispatch is already used in Jordan Hubbard's "NextBSD" effort, and that actually does provide Mach APIs without being an Apple platform.

-- Chris

_______________________________________________
swift-corelibs-dev mailing list
swift-corelibs-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-corelibs-dev