You copied the Doc URL to your clipboard.

Language extension compatibility: keywords

ARM® Compiler 6 provides support for some keywords that are supported in ARM Compiler 5.

Note

This topic includes descriptions of [COMMUNITY] features. See Support level definitions.

The following table lists some of the commonly used keywords that are supported by ARM Compiler 5 and shows whether ARM Compiler 6 supports them using __attribute__. Replace any instances of these keywords in your code with the recommended alternative where available or use inline assembly instructions.

Note

This is not an exhaustive list of all keywords.

Table 3-1 Keyword language extensions in ARM Compiler 5 and ARM Compiler 6

Keyword supported by ARM Compiler 5 Recommended ARM Compiler 6 keyword or alternative
__align(x) __attribute__((aligned(x)))
__alignof__ __alignof__
__ALIGNOF__ __alignof__
Embedded assembly using __asm ARM Compiler 6 does not support the __asm keyword on function definitions and declarations for embedded assembly. Instead, you can write embedded assembly using the __attribute__((naked)) function attribute. See __attribute__((naked)).
__const __attribute__((const))
__attribute__((const)) __attribute__((const))
__forceinline __attribute__((always_inline))
__global_reg Use inline assembler instructions or equivalent routine.
__inline(x) __inline__. The use of this depends on the language mode.
__int64 No equivalent. However, you can use long long. When you use long long in C90 mode, the compiler gives:
  • a warning.
  • an error, if you also use -pedantic-errors.
__INTADDR

[COMMUNITY] None. There is community support for this as a Clang builtin.

__irq __attribute__((interrupt)). This is not supported in AArch64.
__packed

__attribute__((packed)). This provides limited functionality compared to __packed:

  • The __attribute__((packed)) variable attribute applies to members of a structure or union, but it does not apply to variables that are not members of a struct or union.
  • __attribute__((packed)) is not a type qualifier. Taking the address of a packed member can result in unaligned pointers, and in most cases the compiler generates a warning. ARM recommends upgrading this warning to an error when migrating code that uses __packed. To upgrade the warning to error, use the armclang option -Werror=name.

The placement of the attribute is different from the placement of __packed. If your legacy code contains typedef __packed struct, then replace it with:

typedef struct __attribute__((packed))
__pure __attribute__((const))
__smc Use inline assembler instructions or equivalent routine.
__softfp __attribute__((pcs("aapcs")))
__svc Use inline assembler instructions or equivalent routine.
__svc_indirect Use inline assembler instructions or equivalent routine.
__svc_indirect_r7 Use inline assembler instructions or equivalent routine.
__thread __thread
__value_in_regs __attribute__((value_in_regs))
__weak __attribute__((weak))
__writeonly No equivalent.

Note

The __const keyword was supported by older versions of armcc. The equivalent for this keyword in ARM Compiler 5 and ARM Compiler 6 is __attribute__((const)).