3.4. Predefined macros

Table 3.4 lists the macro names predefined by the ARM C and C++ compilers. Where the value field is empty, the symbol is only defined.

Table 3.4. Predefined macros

NameValueWhen defined
__armIf using armcc, tcc, armcpp, or tcpp.
__ARMCC_VERSIONverFor giving the version number of the compiler. The value is the same for the ARM and Thumb compilers. It is a decimal number, whose value can be relied on to increase between releases. The format is PVtbbb where:P is the product (1 for ADS)V is the minor version (2 for 1.2)t is the patch release (0 for 1.2) bbb is the build (750 for example). The example given results in 120750.
__APCS_INTERWORKIf -apcs /interwork in use or the cpu architecture is v5TE.
__APCS_ROPIIf -apcs /ropi in use.
__APCS_RWPIIf -apcs /rwpi in use.
__APCS_SWSTIf -apcs /swst in use.
__BIG_ENDIANIf compiling for a big-endian target.
__cplusplusIn C++ compiler mode.
__CC_ARMReturns compiler name.
__DATE__dateWhen date of translation of source file is required.
__embedded_cplusplusIf in EC++ compiler mode.
__FEATURE_SIGNED_CHARSet by -zc (used by CHAR_MIN and CHAR_MAX).
__FILE__nameThe presumed full pathname of the current source file.
__func__nameThe name of the current function.
__LINE__numWhen line number of the current source file is required.
__MODULE__modContains the filename part of the value of __FILE__.
__OPTIMISE_SPACEIf -Ospace in use.
__OPTIMISE_TIMEIf -Otime in use.
__prettyfunc__nameThe unmangled name of the current function.
__sizeof_int4For sizeof(int), but available in preprocessor expressions.
__sizeof_long4For sizeof(long), but available in preprocessor expressions.
__sizeof_ptr4For sizeof(void *), but available in preprocessor expressions.
__SOFTFP__If compiling to use the software floating-point library. Set if using -fpu softfpa or -fpu softvfp for ARM or Thumb, or if using -fpu softvfp+vfp for Thumb.
__STDC__In all compiler modes.
__STDC_VERSION__Standard version information.
__STRICT_ANSI__Set by -strict.
__TARGET_ARCH_xxxx represents the target architecture and its value depends on the target architecture. For example, if the compiler options -cpu 4T or -cpu ARM7TDMI are specified then __TARGET_ARCH_4T is defined, and no other symbol starting with _TARGET_ARCH_ is defined.
__TARGET_CPU_xx

xx represents the target cpu. The value of xx is derived from the -cpu compiler option, or the default if none is specified. For example, if the compiler option -cpu ARM7TM is specified then _TARGET_CPU_ARM7TM is defined and no other symbol starting with _TARGET_CPU_ is defined.

If the target architecture is specified, then _TARGET_CPU_generic is defined.

If the processor name contains hyphen (-) characters, these are mapped to an underscore (_). For example, -cpu SA-110 is mapped to __TARGET_CPU_SA_110.

__TARGET_FEATURE_DOUBLEWORDIf the target architecture supports the PLD, LDRD, STRD, MCRR, and MRRC instructions.
__TARGET_FEATURE_DSPMULIf the DSP-enhanced multiplier is available.
__TARGET_FEATURE_HALFWORDIf the target architecture supports halfword and signed byte access instructions, for example v5TE.
__TARGET_FEATURE_MULTIPLYIf the target architecture supports the long multiply instructions MULL and MULAL.
__TARGET_FEATURE_THUMBIf the target architecture is Thumb-capable (ARM architecture v4T or later).
__TARGET_FPU_xx

One of the following is set to indicate the FPU usage:

  • __TARGET_FPU_NONE

  • __TARGET_FPU_FPA

  • __TARGET_FPU_SOFTFPA

  • __TARGET_FPU_VFP

  • __TARGET_FPU_SOFTVFP

In addition, if compiling -fpu softvfp+vfp, __TARGET_FPU_SOFTVFP_VFP is also set.

See the description of the -fpu vfp option in Specifying the target processor or architecture for more information on FPU options.

__thumbIf using tcc or tcpp.
__TIME__timeWhen time of translation of the source file is required.
Copyright © 1999-2001 ARM Limited. All rights reserved.ARM DUI 0067D
Non-Confidential