Reputation: 3390
The Clang 6.0.1 avxintrin.h has the declaration:
static __inline __m256i __DEFAULT_FN_ATTRS _mm256_set1_epi32(int)
GCC 5.5 has:
extern __inline __m256i __attribute__((__gnu_inline__, _always_inline__, __artificial__)) _mm256_set1_epi32(int)
Why would one be extern
and one static
? This is showing up for me in an inline
function that calls _mm256_set1_epi32
. Clang wants it to be declared static
:
#include <immintrin.h>
inline void SimdBlockBloomFilter_make_mask() {
_mm256_set1_epi32(1);
}
With -Weverything
:
warning: static function '_mm256_set1_epi32' is used in an inline
function with external linkage [-Wstatic-in-inline]
This error does not show up when compiling with Clang++.
Upvotes: 3
Views: 201
Reputation: 33717
In the GCC version, the gnu_inline
attribute is close to the behavior of static inline
in C99 and later modes.
The C committee ignored the GNU precedent when redefining the meaning of extern inline
: With the GNU compiler, extern inline
meant that the compiler should never generate a non-inline copy of the function (even if its address is taken). In C99, extern inline
means that a definition in a translation unit completes an inline
definition in another translation unit.
The GCC version of <immintrin.h>
uses the gnu_inline
attribute to get the expected behavior in all compiler modes (C89/C90 and C99 in particular).
Upvotes: 4