mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-10 11:14:05 +02:00
Merge branch 'wip/smcv/os-detect' into 'main'
docs: Mention platform-specific predefined macros See merge request GNOME/glib!2997
This commit is contained in:
16
glib/docs.c
16
glib/docs.c
@@ -2020,6 +2020,22 @@
|
|||||||
*
|
*
|
||||||
* This macro is defined only on UNIX. So you can bracket
|
* This macro is defined only on UNIX. So you can bracket
|
||||||
* UNIX-specific code in "\#ifdef G_OS_UNIX".
|
* UNIX-specific code in "\#ifdef G_OS_UNIX".
|
||||||
|
*
|
||||||
|
* To detect whether to compile features that require a specific kernel
|
||||||
|
* or operating system, check for the appropriate OS-specific predefined
|
||||||
|
* macros instead, for example:
|
||||||
|
*
|
||||||
|
* - Linux kernel (any libc, including glibc, musl or Android): `\#ifdef __linux__`
|
||||||
|
* - Linux kernel and GNU user-space: `\#if defined(__linux__) && defined(__GLIBC__)`
|
||||||
|
* - FreeBSD kernel (any libc, including glibc): `\#ifdef __FreeBSD_kernel__`
|
||||||
|
* - FreeBSD kernel and user-space: `\#ifdef __FreeBSD__`
|
||||||
|
*
|
||||||
|
* See <https://sourceforge.net/p/predef/wiki/OperatingSystems/> for more.
|
||||||
|
*
|
||||||
|
* GLib defines OS-detection macros for some categories of systems
|
||||||
|
* that can be less straightforward to detect, such as %G_OS_DARWIN, but
|
||||||
|
* intentionally does not provide its own equivalents of macros like
|
||||||
|
* `__linux__`.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user