Overview of C++ language support in Apple Clang
developer.apple.com
developer.apple.com
I don't understand why they deviate so much from mainstream clang. I think they'd be better off being closer to the trunk. TBH I don't really understand why they have their own tree at all.
So, they pick what’s current early in a project and stick with it.
They may add a few backports of bug fixes to that, but that’s it.
IMO, that’s a good strategy.
You do realize that everything from llvm/clang, gcc, libc++ to libstdc++ is open source? MSVC is late in that regard (and the compiler itself is as closed as can be).
I assume you mean "as a developer [anybody] developing software on an Apple platform".
I would be surprised if Apple employees were free to choose their compiler.
Remember that supporting C++ features isn’t just about emitting code, it’s about the implementation of libstdc++/libc++ that you have to make sure you don’t paint yourself into a corner with. It’s easy to accidentally write code that needs to be linked to one way, then later on in the development cycle, subtly change it in a way that changes a symbol, or a type layout, etc. This is all fiddly work that they have to spend time getting right.
You mention other compiler vendors: I remember very distinctly times when GCC would change the ABI to libstdc++. I was running Debian sid at the time and there was basically a month where the OS was not usable at all, as packages had to be recompiled against the new libstdc++.
These kinds of issues happen where, if you let people use a complier (and its corresponding stdlib implementation) before it’s ready, you may find that you have to break ABI in order to fix issues with your new language support, and you leave people stranded who may have already compiled their code against the old stdlib.
ABI doesn’t just mean calling conventions defined in things like Itanium’s spec. It also means name mangling, size of structs, and many other things. Think “if I make a shared lib and compile it, and a bunch of programs link to it dynamically at runtime, what changes to the lib can break those programs after the fact, if they don’t recompile?” The answer ends up being a lot. Again, remember that supporting new C++ features means adding things to libc++, which is linked at runtime, so you don’t want to mess it up.
Again, I don’t just mean “change the ABI of arbitrary code emitted by the compiler”, I mean the particular exported symbols in the particular implementation of libc++, which is dynamically linked. If they decide to add one extra field to a struct exported by that lib, then oops, they broke ABI. You don’t want to mess this up and you want it to be stable before letting people use it.
It would always be nice to slim the differences and get new releases faster though, of course.
Then they used to have the integration of blocks (C extension for lambdas) into the respective frameworks, and their own bitcode format was more stable than LLVM bitcode (deprecated now, most likely fed up with the bitcode fork).
(The problem is exacerbated by the ridiculous fact that macOS includes a 'gcc' alias that is not in fact GCC, and which risks shadowing a proper GCC that the students install themselves.)
Depending on the platforms you need to support, a more heavyweight but more reproducible solution would be to use a fixed LLVM toolchain, say using Bazel.
I think the track record of Apple on supporting anything standardized speaks for itself (see OpenGL, OpenCL, OpenMP, C & C++ features, etc) - Apple gives as few fucks about cross-platform development as possible. Apple sees its platform being so valuable that developers will jump through whatever hoops Apple puts in their way, and largely their developers put up with this.
I will note here that this vendor lock-in is one of the (if not the) main reasons Apple et al. moved away from the GPLed GCC.
The ability to lock in users is the central difference between open source and Free Software.
As such, this is WAI from the Open Source perspective.
There are a couple of notable examples of major software shipping OpenMP-using code on MacOS, namely R and Matlab, but the structure of these projects means that few of their users have to encounter the complexity of getting an OpenMP-supporting toolchain working. Not so easy for a library author where nearly all of your users will need to use a special toolchain.
Sure, and one of their users could have distributed a version that put it back in.
And GCD is open source (not sure when the source was first made available, though). It even supports Linux (thanks to Swift) though that’s recent.
libdispatch is open source, and available on Linux, but I can't see any reason to use it versus the alternatives of TBB and OpenMP, unless you were trying to port an application/library originally written for MacOS/iOS.
[1] https://en.wikipedia.org/wiki/Xcode#Xcode_11.0_-_14.x_(since...
note that this sadly will require your users to use a macOS version that isn't even released yet (or rebuild your own libc++) as Apple ties libc++ to the OS releases. when I see the amount of people around me still on 10.x...
It is a small note "Minimum deployment target" at the original article. Seems like features tied to target OS are: PMR, filesystem, to_chars/from_chars and newest atomic-based synchronisation primitives.
[0] https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2021/p23...
https://web.archive.org/web/20190403123249/http://llvm.org/d...
MacPorts suggests that the --version string changed in Xcode 11 with macOS 10.14 Mojave, but I don't know if the Clang name was reflected in the Xcode GUI at that point. https://trac.macports.org/wiki/XcodeVersionInfo
Clang is a compiler for C and C++ and Objective-C and Objective-C++.
LLVM is the underlying technology which is used by clang, but it's also used by other compilers (e.g. Swift uses LLVM, and some major JavaScript compilers as well).
Neither is owned by Apple - they're open source projects with contributors from Microsoft, Google, ARM, Intel, AMD and many others.
Thank goodness. Those deprecatios are a pain in the butt.