intel / ARM_NEON_2_x86_SSE

The platform independent header allowing to compile any C/C++ code containing ARM NEON intrinsic functions for x86 target systems using SIMD up to AVX2 intrinsic functions
Other
430 stars 149 forks source link

Fix warnings of "-Wunused-function" in gcc 5.4.0 on Ubuntu 16.04.1 #39

Closed maxint closed 4 years ago

maxint commented 4 years ago

Fix many compiler warnings like following in gcc 5.4.0.

warning: ‘uint32x4_t vreinterpretq_u32_f32(float32x4_t)’ declared ‘static’ but never defined [-Wunused-function]
 _NEON2SSESTORAGE uint32x4_t vreinterpretq_u32_f32 (float32x4_t t);

These warnings could not be disabled simply by pragma GCC diagnostic commands .

#   ifdef _MSC_VER
#       pragma warning(push)
#       pragma warning(disable: 4838)
#       pragma warning(disable: 4309)
#       pragma warning(disable: 4838)
#       pragma warning(disable: 4244)
#       pragma warning(disable: 4245)
#       pragma warning(disable: 4100)
#   elif defined(__GNUC__)
#       pragma GCC diagnostic push
#       pragma GCC diagnostic ignored "-Wsequence-point"
// #       pragma GCC diagnostic ignored "-Wunused-function" // unused static functions (NOT WORK)
#       pragma GCC diagnostic ignored "-Wunused-parameter"
#       pragma GCC diagnostic ignored "-Wstrict-aliasing" // _MM_EXTRACT_PS
#   endif // _MSC_VER
#   define NEON2SSE_DISABLE_PERFORMANCE_WARNING // disable performance warning
// https://github.com/intel/ARM_NEON_2_x86_SSE/blob/master/NEON_2_SSE.h
#   include "NEON_2_SSE.h"
#   ifdef _MSC_VER
#       pragma warning(pop)
#   elif defined(__GNUC__)
#       pragma GCC diagnostic pop
#   endif // _MSC_VER
Zvictoria commented 4 years ago

Hi there. Have you checked the header with removed "static" usage with include in multiple files of the same project? It doesn't work with the compilers I have for sure.

maxint commented 4 years ago

Hi Zvictoria, It's OK to include the new header in multiple c++ source files in one library. Maybe I should check the c case.

Zvictoria commented 4 years ago

Could you check C case please? It looks strange to me - compiler should see multiple functions re-definitions and complain about it.

maxint commented 4 years ago

I try to include the header in two c sources, compiler reported errors like this:

NEON_2_SSE.h: In function ‘vsetq_lane_u16’:
NEON_2_SSE.h:2294:29: error: selector must be an integer constant in the range 0..7
 #   define _MM_INSERT_EPI16 _mm_insert_epi16
                             ^
NEON_2_SSE.h:9406:40: note: in expansion of macro ‘_MM_INSERT_EPI16’
 #define vld1q_lane_u16(ptr, vec, lane) _MM_INSERT_EPI16(vec, *(ptr), lane)

Then I revert the changes, it reported warnings in C++ sources 😭 :

NEON_2_SSE.h:16172:29: warning: ‘vreinterpretq_p16_s32’ declared ‘static’ but never defined [-Wunused-function]
 _NEON2SSESTORAGE poly16x8_t vreinterpretq_p16_s32 (int32x4_t t);
maxint commented 4 years ago

Close the pull request temporarily.