You copied the Doc URL to your clipboard.

Language extension compatibility

ARM Compiler 6 provides support for some language extensions that were supported in older compiler versions. Other language extensions are not supported, or must be replaced with alternatives.

The following table lists some of the commonly used language extensions that are supported by older versions of the compiler but are not supported by ARM Compiler 6. Replace any instances of these language extensions in your code with the recommended alternative.

Note

This is not an exhaustive list of all unsupported language extensions.

Table 3-1 Language extensions that must be replaced

Language extension supported by older compiler versions Recommended ARM Compiler 6 alternative
#pragma import (symbol) asm(" .global symbol\n")
__align(x) __attribute__((aligned(x)))
__clz Use an inline CLZ assembly instruction or equivalent routine.
__const __attribute__((const))
__dmb Use an inline DMB assembly instruction or equivalent CP15 instruction.
__dsb Use an inline DSB assembly instruction or equivalent CP15 instruction.
__forceinline __attribute__((always_inline))
__inline __inline__
__isb Use an inline ISB assembly instruction or equivalent CP15 instruction.
__ldrex Use an inline LDREX assembly instruction.
__packed __attribute__((packed, aligned(1)))
__pure __attribute__((pure))
__rev Use an inline REV assembly instruction.
__sev Use an inline SEV assembly instruction.
__softfp __attribute__((__pcs__("aapcs")))
__strex Use an inline STREX assembly instruction.
__weak __attribute__((weak))
__wfe Use an inline WFE assembly instruction.

The following language extensions are supported by older compiler versions and ARM Compiler 6. These language extensions do not require modification in your code:

  • __attribute__((aligned(x)))
  • __attribute__((always_inline))
  • __attribute__((const))
  • __attribute__((deprecated))
  • __attribute__((nonnull))
  • __attribute__((noreturn))
  • __declspec(noreturn)
  • __declspec(nothrow)
  • __attribute__((pcs("calling convention")))
  • __attribute__((pure))
  • __attribute__((section("name")))
  • __attribute__((unused))
  • __attribute__((used))
  • __attribute__((visibility))
  • __attribute__((weak))
  • __attribute__((weakref))

The following pragmas are the only pragmas supported both by older compiler versions and ARM Compiler 6:

  • #pragma GCC system_header
  • #pragma once
  • #pragma pack
  • #pragma weak