9.150 Predefined macros
9.150 Predefined macros
The ARM compiler predefines a number of macros. These macros provide information about toolchain version numbers and compiler options.
The following table lists the macro names predefined by the ARM compiler for C and C++. Where the value field is empty, the symbol is only defined.
Table 9-21 Predefined macros
| Name | Value | When defined | 
|---|---|---|
| __arm__ | - | Always defined for the ARM compiler, even when you specify the  --thumboption.See also  __ARMCC_VERSION. | 
| __ARMCC_VERSION | ver | Always defined. It is a decimal number, and is guaranteed to increase between releases. The format is  PVVbbbbwhere:
 NoteUse this macro to distinguish between ARM Compiler 4.1 or later, and other tools that define  __arm__. | 
| __APCS_INTERWORK | - | When you specify the  --apcs /interworkoption or set the target processor architecture to ARMv5T or later. | 
| __APCS_ROPI | - | When you specify the  --apcs /ropioption. | 
| __APCS_RWPI | - | When you specify the  --apcs /rwpioption. | 
| __APCS_FPIC | - | When you specify the  --apcs /fpicoption. | 
| __ARRAY_OPERATORS | - | In C++ compiler mode, to specify that array new and delete are enabled. | 
| __BASE_FILE__ | name | Always defined. Similar to  __FILE__, but indicates the primary source file rather than the current one (that is, when the current file is an included file). | 
| __BIG_ENDIAN | - | If compiling for a big-endian target. | 
| _BOOL | - | In C++ compiler mode, to specify that  boolis a keyword. | 
| __cplusplus | - | In C++ compiler mode. | 
| __CC_ARM | 1 | Always set to 1 for the ARM compiler, even when you specify the  --thumboption. | 
| __DATE__ | date | Always defined. | 
| __EDG__ | - | Always defined. | 
| __EDG_IMPLICIT_USING_STD | - | In C++ mode when you specify the  --using_stdoption. | 
| __EDG_VERSION__ | - | Always set to an integer value that represents the version number of the Edison Design Group (EDG) front-end. For example, version 3.8 is represented as  308.NoteThe version number of the EDG front-end does not necessarily match the version number of the ARM compiler toolchain. | 
| __EXCEPTIONS | 1 | In C++ mode when you specify the  --exceptionsoption. | 
| __FEATURE_SIGNED_CHAR | - | When you specify the  --signed_charsoption (used byCHAR_MINandCHAR_MAX). | 
| __FILE__ | name | Always defined as a string literal. | 
| __FP_FAST | - | When you specify the  --fpmode=fastoption. | 
| __FP_FENV_EXCEPTIONS | - | When you specify the  --fpmode=ieee_fullor--fpmode=ieee_fixedoptions. | 
| __FP_FENV_ROUNDING | - | When you specify the  --fpmode=ieee_fulloption. | 
| __FP_IEEE | - | When you specify the  --fpmode=ieee_full,--fpmode=ieee_fixed, or--fpmode=ieee_no_fenvoptions. | 
| __FP_INEXACT_EXCEPTION | - | When you specify the  --fpmode=ieee_fulloption. | 
| __IMPLICIT_INCLUDE | - | When you specify the  --implicit_includeoption. | 
| __LINE__ | num | Always set. It is the source line number of the line of code containing this macro. | 
| __MODULE__ | mod | Contains the filename part of the value of  __FILE__. | 
| __MULTIFILE | - | When you explicitly or implicitly use the --multifileoption.a | 
| __OPTIMISE_LEVEL | num | Always set to 2 by default, unless you change the optimization level using the  -Ooption.a | 
| __OPTIMISE_SPACE | - | When you specify the  -Ospaceoption. | 
| __OPTIMISE_TIME | - | When you specify the  -Otimeoption. | 
| __OPTIMIZE__ | - | When  -O1,-O2, or-O3is specified in GNU mode. | 
| __OPTIMIZE_SIZE__ | - | When  -Ospaceis specified in GNU mode. | 
| __PLACEMENT_DELETE | - | In C++ mode to specify that placement delete (that is, an operator deletecorresponding to a placement operatornew, to be called if the constructor throws an exception) is enabled. This is only relevant when using exceptions. | 
| __RTTI | - | In C++ mode when RTTI is enabled. | 
| __sizeof_int | 4 | For  sizeof(int), but available in preprocessor expressions. | 
| __sizeof_long | 4 | For  sizeof(long), but available in preprocessor expressions. | 
| __sizeof_ptr | 4 | For  sizeof(void *), but available in preprocessor expressions. | 
| __SOFTFP__ | - | If compiling to use the software floating-point calling standard and library. Set when you specify the  --fpu=softvfpoption for ARM or Thumb, or when you specify--fpu=softvfp+vfpv2for Thumb. | 
| __STDC__ | - | In all compiler modes. | 
| __STDC_VERSION__ | - | Standard version information. | 
| __STRICT_ANSI__ | - | When you specify the  --strictoption. | 
| __SUPPORT_SNAN__ | - | Support for signalling NaNs when you specify --fpmode=ieee_fixedor--fpmode=ieee_full. | 
| __TARGET_ARCH_ARM | num | The number of the ARM base architecture of the target processor irrespective of whether the compiler is compiling for ARM or Thumb. For possible values of __TARGET_ARCH_ARMin relation to the ARM architecture versions, see the table below. | 
| __TARGET_ARCH_THUMB | num | The number of the Thumb base architecture of the target processor irrespective of whether the compiler is compiling for ARM or Thumb. The value is defined as zero if the target does not support Thumb. For possible values of  __TARGET_ARCH_THUMBin relation to the ARM architecture versions, see the table below. | 
| __TARGET_ARCH_ | - | represents the target architecture and its value depends on the target architecture. For example, if you specify the compiler options--cpu=4Tor--cpu=ARM7TDMIthen__TARGET_ARCH_4Tis defined. | 
| __TARGET_CPU_ | - | represents the target processor. The value ofis derived from the--cpucompiler option, or the default if none is specified. For example, if you specify the compiler option--cpu=ARM7TMthen__TARGET_CPU_ARM7TMis defined and no other symbol starting with__TARGET_CPU_ is defined.If you specify the target architecture, then  __TARGET_CPU_genericis defined.If the processor name specified with  --cpuis in lowercase, it is converted to uppercase. For example,--cpu=Cortex-R4results in__TARGET_CPU_CORTEX_R4being defined (rather than__TARGET_CPU_Cortex_R4).If the processor name contains hyphen (-) characters, these are mapped to an underscore ( _). For example,--cpu=ARM1136JF-Sis mapped to__TARGET_CPU_ARM1136JF_S. | 
| __TARGET_FEATURE_DOUBLEWORD | - | ARMv5T and above. | 
| __TARGET_FEATURE_DSPMUL | - | If the DSP-enhanced multiplier is available, for example ARMv5TE. | 
| __TARGET_FEATURE_MULTIPLY | - | If the target architecture supports the long multiply instructions  MULLandMULAL. | 
| __TARGET_FEATURE_DIVIDE | - | If the target architecture supports the hardware divide instruction (that is, ARMv7-M or ARMv7-R). | 
| __TARGET_FEATURE_THUMB | - | If the target architecture supports Thumb, ARMv4T or later. | 
| __TARGET_FPU_ | - | One of the following is set to indicate the FPU usage: 
 In addition, if compiling with one of the following  --fpuoptions, the corresponding target name is set:
 | 
| __TARGET_PROFILE_R | When you specify the --cpu=7-R option. | |
| __TARGET_PROFILE_M | When you specify any of the following options: 
 | |
| __thumb__ | - | When the compiler is in Thumb state. That is, you have either specified the  --thumboption on the command-line or#pragma thumbin your source code.Note
 | 
| __TIME__ | time | Always defined. | 
| _WCHAR_T | - | In C++ mode, to specify that  wchar_tis a keyword. | 
The following table shows the possible values for 
__TARGET_ARCH_THUMB, and how these values relate to versions of the ARM architecture.
 
                
            
         
         浙公网安备 33010602011771号
浙公网安备 33010602011771号