gcc预定义宏

GCC预定义宏说明

$ gcc -dM -E - < /dev/null >> macro_x86_64_win7_mingw.txt
$ g++ -dM -E -x c++ - < /dev/null
$ gcc -dM -E - < /dev/null >> macro_x86_64_linux.txt
$ g++ -dM -E -x c++ - < /dev/null

macro_x86_64_win7_mingw.txt

#define __x86_64 1
#define __MINGW32__ 1
#define __MINGW64__ 1
#define __WIN32__ 1
#define _WIN64 1

macro_x86_64_linux.txt

#define __x86_64 1
#define linux 1
#define __linux 1
#define __linux__ 1
#define __gnu_linux__ 1


clang预定义宏

$ android-ndk-r20b/toolchains/llvm/prebuilt/linux-x86_64/bin/i686-linux-android26-clang -dM -E -x c /dev/null  >> macro_i686_linux_android26.txt

$ android-ndk-r20b/toolchains/llvm/prebuilt/linux-x86_64/bin/x86_64-linux-android26-clang  -dM -E -x c /dev/null  >> macro_x86_64_linux_android26.txt

$ android-ndk-r20b/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi26-clang  -dM -E -x c /dev/null  >> macro_armv7a_linux_androideabi26.txt

macro_i686_linux_android26.txt

#define __clang__ 1
#define __clang_major__ 8
#define __clang_minor__ 0
#define __clang_patchlevel__ 7
#define i386 1
#define __i386 1
#define __i386__ 1
#define __i686 1
#define __i686__ 1
#define linux 1
#define __linux 1
#define __linux__ 1
#define __ANDROID_API__ 26
#define __ANDROID__ 1

macro_x86_64_linux_android26.txt

#define __clang__ 1
#define __clang_major__ 8
#define __clang_minor__ 0
#define __clang_patchlevel__ 7
#define __x86_64 1
#define __x86_64__ 1
#define linux 1
#define __linux 1
#define __linux__ 1
#define __ANDROID_API__ 26
#define __ANDROID__ 1

macro_armv7a_linux_androideabi26.txt

#define __clang__ 1
#define __clang_major__ 8
#define __clang_minor__ 0
#define __clang_patchlevel__ 7
#define __ARMEL__ 1
#define __ARM_32BIT_STATE 1
#define __ARM_ACLE 200
#define __ARM_ARCH 7
#define __ARM_ARCH_7A__ 1
#define __ARM_ARCH_ISA_ARM 1
#define __ARM_ARCH_ISA_THUMB 2
#define __ARM_ARCH_PROFILE 'A'
#define __ARM_EABI__ 1
#define linux 1
#define __linux 1
#define __linux__ 1
#define __ANDROID_API__ 26
#define __ANDROID__ 1