B3.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.
Example
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
}
Note:
__attribute__((always_inline)) does not affect the linkage characteristics of the function in the same way that the inline function-specifier does. When using __attribute__((always_inline)), if you want the declaration and linkage of the function to follow the rules of the inline function-specifier of the source language, then you must also use the keyword inline or __inline__ (for C90). For example:
inline int max(int x, int y) __attribute__((always_inline));
int max(int x, int y)
{
return x > y ? x : y; // always inline if possible
}
Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers of your data.