when i try to include a .h file which consists of definition for inline functions as
__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SLA (int32_t o1, int32_t o2, int32_t o3)
it is giving the "warning: always_inline function might not be inlinable [-Wattributes]" can you somebody help me i am struggling to fix it.
For functions declared inline(!!!!), this attribute inlines the function independent of any restrictions that otherwise apply to inlining.
So, when you set the attribute without declaring the function inline you will get these warning. Declare the function additionally inline will void these warnings. Behavior gnu gcc/g++ 5.30
# define FORCE_INLINE __attribute__((always_inline)) inline
FORCE_INLINE vec3 operator- (vec3 a, vec3 b) { vec3 t = { a.x-b.x, a.y-b.y, a.z-b.z }; return t; }
it is just because of a compiler(arm-none-eabi-gcc) option in Makefile
CFLAGS= -D inline
if this flag is set, it throws warning as __attribute__( ( always_inline ) ) __STATIC_INLINE(inline) uint32_t __SLA (int32_t o1, int32_t o2, int32_t o3)
when trying to include a .h file which consists of always inline functions
What that warning is saying is that the compiler, is not always happy accepting your function as inline, or it wants it to be declared as inline.
I guess it's that __attribute__ ((always_inline))
implies inline
- in which case the parsing of the attribute needs to set DECL_DECLARED_INLINE_P
.
The GCC manual specifies
always_inline Generally, functions are not inlined unless optimization is specified. For functions declared inline, this attribute inlines the function even if no optimization level is specified.
Here's the gcc
test for the revision
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With