warning: always_inline function might not be inlinable [-Wattributes]

后端 未结 3 624
说谎
说谎 2021-01-04 03:04

when i try to include a .h file which consists of definition for inline functions as

__attribute__( ( always_inline ) ) __STATIC_INLINE uint32_t __SLA (int3         


        
3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-04 03:39

    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; }
    

提交回复
热议问题