3.2 __attribute__((always_inline)) function attribute

This function attribute indicates that a function must be inlined.

The compiler attempts to inline the function, regardless of the characteristics of the function.

In some circumstances, the compiler might choose to ignore __attribute__((always_inline)), and not inline the function. For example:

  • A recursive function is never inlined into itself.
  • Functions that use alloca() might not be inlined.


static int max(int x, int y) __attribute__((always_inline));
static int max(int x, int y)
    return x > y ? x : y; // always inline if possible
Non-ConfidentialPDF file icon PDF versionDUI0774J
Copyright © 2014–2017, 2019 Arm Limited or its affiliates. All rights reserved.