Default macros of GCC

X86/GCC/Linux

gcc -posix -E -dM - < /dev/null 


#if defined(__x86_64__) || defined(_M_X64)
     /* x86 64-bit ----------------------------------------------- */
 
#elif defined(__i386) || defined(_M_IX86)
     /* x86 32-bit ----------------------------------------------- */
 
#endif



MinGW/Windows

gcc -posix -E -dM - < nul

lhu@Windows10_64bit ~
$ gcc -posix -E -dM - < nul |grep WIN
#define _WIN32 1
#define __WINT_MAX__ 0xffff
#define __WINT_MIN__ 0
#define __WIN32 1
#define __WINNT 1
#define __WINNT__ 1
#define __WIN32__ 1
#define __SIZEOF_WINT_T__ 2
#define WIN32 1
#define __WINT_TYPE__ short unsigned int
#define WINNT 1


ARM 

arm-linux-gnueabihf-gcc  -posix -E -dM - < /dev/null 

Or

lake@localhost:~$ arm-linux-gnueabihf-gcc  -E -dM -c test.c >> marco_ARM-gnueabihf.txt

lake@localhost:~/tmp$ grep ARM     marco_ARM-gnueabihf.txt 
#define __ARMEL__ 1
#define __ARM_FEATURE_UNALIGNED 1
#define __ARM_PCS_VFP 1
#define __ARM_ARCH_7A__ 1
#define __ARM_EABI__ 1
#define __ARM_FEATURE_DSP 1



猜你喜欢

转载自blog.csdn.net/hushui/article/details/80063378
gcc