Predefined macros in compilers(clang, gcc)

To list clang’s pre-defined macros for clang, run:

clang -x c /dev/null -dM -E

To list gcc’s pre-defined macros for gcc, run:

gcc -x c /dev/null -dM -E

The macros are used for checking which OS(platform) is compiled at compiling time:

Linux and Linux-derived __linux__
Darwin (Mac OS X and iOS) __APPLE__
FreeBSD __FreeBSD__

Ref Guide to predefined macros in C++ compilers (gcc, clang, msvc etc.)