docs: Mention platform-specific predefined macros
The platform-specific predefined macros provided by various compilers sometimes capture subtle differences of meaning, like the distinction between the Linux kernel and a glibc-based (GNU/Linux) user-space. It would be difficult to capture those subtleties in GLib-specific convenience macros, particularly for platforms that we don't use ourselves.
Instead, recommend that anyone who is already writing platform-specific code should use the platform-specific predefined macros directly.
Alternative to !2986 (closed).
/cc @pwithnall @3v1n0 @matthiasc
This is basically just documenting the approach that @matthiasc advocated on !2986 (closed) as being official. I personally like this better than !2986 (closed).
I actually wonder whether we should also remove the new G_OS_DARWIN
from the 2.75.x branch, and replace uses of it with __APPLE__
, reverting most of !2981 (merged). Strictly speaking __APPLE__
could either be Mac OS Classic (ye olde cooperatively-multitasking, non-privilege-separated OS with its various non-Unix oddities) or the Darwin family (iOS, tvOS and modern macOS), but GLib no longer supports Mac OS Classic anyway, so anyone who is compiling GLib can assume that __APPLE__
means the Darwin family.
One thing from !2981 (merged) that seems correct to keep is that it switched non-GUI stuff from HAVE_COCOA
to G_OS_DARWIN
, and we would want to swap that to __APPLE__
instead of bringing back HAVE_COCOA
, because Cocoa is a specific GUI framework rather than an OS - so looking at HAVE_COCOA
was a bit like choosing whether to compile GNOME-specific or freedesktop-specific code by looking at HAVE_GTK
.