| |||
| Home > Compiler-specific Features > Compiler predefines | |||
This section documents the predefined macros of the ARM compiler.
Table 28 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 28. Predefined macros
| Name | Value | When defined |
|---|---|---|
__arm__ | - | Always defined for the ARM compiler,
even when you specify the See
also |
__ARM_NEON__ | - | When compiler This macro can be used
to conditionally include |
__ARMCC_VERSION | ver | Always defined. It is a decimal number,
and is guaranteed to increase between releases. The format is
NoteUse this macro to distinguish between ARM Compiler 4.1 and
other tools that define |
__APCS_INTERWORK | - | When you specify the |
__APCS_ROPI | - | When you specify the |
__APCS_RWPI | - | When you specify the |
__APCS_FPIC | - | When you specify the |
__ARRAY_OPERATORS | - | In C++ compiler mode, to specify that array new and delete are enabled. |
__BASE_FILE__ | name | Always defined. Similar to |
__BIG_ENDIAN | - | If compiling for a big-endian target. |
_BOOL | - | In C++ compiler mode, to specify that bool is a keyword. |
__cplusplus | - | In C++ compiler mode. |
__CC_ARM | 1 | Always set to 1 for the ARM compiler,
even when you specify the |
__CHAR_UNSIGNED__ | - | In GNU mode. It is defined if and only if char is an unsigned type. |
__DATE__ | date | Always defined. |
__EDG__ | - | Always defined. |
__EDG_IMPLICIT_USING_STD | - | In C++ mode when you specify the |
__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 The 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 |
__FEATURE_SIGNED_CHAR | - | When you specify the |
__FILE__ | name | Always defined as a string literal. |
__FP_FAST | - | When you specify the |
__FP_FENV_EXCEPTIONS | - | When you specify the |
__FP_FENV_ROUNDING | - | When you specify the |
__FP_IEEE | - | When you specify the |
__FP_INEXACT_EXCEPTION | - | When you specify the |
__GNUC__ | ver | When you specify the |
__GNUC_MINOR__ | ver | When you specify the |
__GNUG__ | ver | In GNU mode when you specify the --cpp option.
It has the same value as __GNUC__. |
__IMPLICIT_INCLUDE | - | When you specify the |
__INTMAX_TYPE__ | - | In GNU mode. It defines the correct underlying
type for the intmax_t typedef. |
__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 |
__MULTIFILE | -- | When you explicitly or implicitly use the --multifile option.[a] |
__NO_INLINE__ | - | When you specify the |
__OPTIMISE_LEVEL | num | Always set to 2 by default, unless you
change the optimization level using the |
__OPTIMISE_SPACE | - | When you specify the |
__OPTIMISE_TIME | - | When you specify the |
__OPTIMIZE__ | - | When |
__OPTIMIZE_SIZE__ | - | When |
__PLACEMENT_DELETE | - | In C++ mode to specify that placement delete (that is, an operator delete corresponding to a placement operator new, to be called if the constructor throws an exception) is enabled. This is only relevant when using exceptions. |
__PTRDIFF_TYPE__ | - | In GNU mode. It defines the correct underlying
type for the ptrdiff_t typedef. |
__RTTI | - | In C++ mode when RTTI is enabled. |
__sizeof_int | 4 | For |
__sizeof_long | 4 | For |
__sizeof_ptr | 4 | For |
__SIZE_TYPE__ | - | In GNU mode. It defines the correct underlying
type for the size_t typedef. |
__SOFTFP__ | - | If compiling to use the software floating-point
calling standard and library. Set when you specify the |
__STDC__ | - | In all compiler modes. |
__STDC_VERSION__ | - | Standard version information. |
__STRICT_ANSI__ | - | When you specify the |
__SUPPORT_SNAN__ | - | Support for signalling NaNs when you specify --fpmode=ieee_fixed or --fpmode=ieee_full. |
__TARGET_ARCH_ARM | num | The number of the ARM base architecture of
the target CPU irrespective of whether the compiler is compiling
for ARM or Thumb. For possible values of __TARGET_ARCH_ARM in
relation to the ARM architecture versions, see Table 29. |
__TARGET_ARCH_THUMB | num | The number of the Thumb base architecture
of the target CPU 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_ | - |
|
__TARGET_CPU_ | - |
If you specify the target architecture, then If
the CPU name specified with If
the processor name contains hyphen (-) characters, these are mapped to
an underscore ( |
__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 |
__TARGET_FEATURE_DIVIDE | - | If the target architecture supports the hardware divide instruction (that is, ARMv7-M or ARMv7-R). |
__TARGET_FEATURE_MULTIPROCESSING | - | When you specify any of the following options:
|
__TARGET_FEATURE_NEON | - | When you specify any of the following options:
|
__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
See ‑‑fpu=name for more information. |
__TARGET_PROFILE_A | When you specify the --cpu=7-A option. | |
__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 mode. That
is, you have either specified the Note
|
__TIME__ | time | Always defined. |
__UINTMAX_TYPE__ | - | In GNU mode. It defines the correct underlying
type for the uintmax_t typedef. |
__USER_LABEL_PREFIX__ | In GNU mode. It defines an empty string. This macro is used by some of the Linux header files. | |
__VERSION__ | ver | When you specify the |
_WCHAR_T | - | In C++ mode, to specify that wchar_t is a keyword. |
__WCHAR_TYPE__ | - | In GNU mode. It defines the correct underlying
type for the wchar_t typedef. |
__WCHAR_UNSIGNED__ | - | In GNU mode when you specify the --cpp option.
It is defined if and only if wchar_t is an unsigned
type. |
__WINT_TYPE__ | - | In GNU mode. It defines the correct underlying
type for the wint_t typedef. |
[a] ARM recommends that if you have source
code reliant on the | ||
Table 29 shows
the possible values for __TARGET_ARCH_THUMB (see Table 28), and how
these values relate to versions of the ARM architecture.
Table 29. Thumb architecture versions in relation to ARM architecture versions
| ARM architecture | __TARGET_ARCH_ARM | __TARGET_ARCH_THUMB |
|---|---|---|
| v4 | 4 | 0 |
| v4T | 4 | 1 |
| v5T, v5TE, v5TEJ | 5 | 2 |
| v6, v6K, v6Z | 6 | 3 |
| v6T2 | 6 | 4 |
| v6-M, v6S-M | 0 | 3 |
| v7-A, v7-R | 7 | 4 |
| v7-M, v7E-M | 0 | 4 |
Table 30 lists builtin variables supported by the compiler for C and C++.
Table 30. Builtin variables
| Name | Value |
|---|---|
__FUNCTION__ | Holds the name of the function as it appears in the source.
|
__PRETTY_FUNCTION__ | Holds the name of the function as it appears pretty printed in a language-specific fashion.
|