I have found the following function definition :
static inline __attribute__((always_inline)) int fn(const char *s)
{
return (!s || (*s == \'\\0\'));
}
The often referred gcc documentation for always_inline
is inaccurate.
This attribute makes the compiler ignore -fno-inline
(this is what the documentation says) and the inlining limits hence inlining the function anyway. Also, it inlines functions with alloca
calls, which inline
keyword never does.
An interesting bechmark: always_inline performance.
It forces the compiler to inline the function even if optimizations are disabled. Check this documentation for more information.