[clang] [llvm] [Darwin][Driver][clang] apple-none-macho orders the resource directory after internal-externc-isystem when nostdlibinc is used (PR #120507)

Ian Anderson via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 3 12:04:41 PST 2025


ian-twilightcoder wrote:

> > > as Swift expects all MachO targets to have that defined.
> > 
> > 
> > can you elaborate on that expectation?
> 
> [shims/Visibility.h](https://github.com/swiftlang/swift/blob/main/stdlib/public/SwiftShims/swift/shims/Visibility.h#L137) uses `__MACH__` to figure out how to configure the visibility attributes. It's taking `__MACH__` to mean Mach-O and not dyld. Without that, apple-none-macho falls down to Windows declspec which is an error. libc++'s [__configuration/platform.h](https://github.com/llvm/llvm-project/blob/main/libcxx/include/__configuration/platform.h#L21) takes the same meaning. usr/include/TargetConditionals.h also equates `__MACH__` to Mach-O.

Actually the TargetConditionals.h use seems to be more like "running Mac OS X native" as opposed to "running in Mac OS 9 or the Classic environment on Mac OS X". gssapi/gssapi.h and krb5/krb5.h is using it for the same purpose. There's similar use in unicode/platform.h and dispatch/dispatch.h, though it's a little less clear if they're trying to figure out (it almost looks like they just don't know about `__has_include` or don't want to use it because it's not supported by every compiler?).

https://github.com/llvm/llvm-project/pull/120507


More information about the llvm-commits mailing list