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

warning as error #40

Closed adahbingee closed 4 years ago

adahbingee commented 4 years ago

GCC 9.3.0 throws warnings

This is very agony when using warning as error in -Wall -Werror

Bizonu commented 4 years ago
adahbingee commented 4 years ago

Great work! Now only the unused-function need to be solved. Any suggestions?

Bizonu commented 4 years ago

For the unused-function warnings, I think that the only way to solve them is to remove the declaration from the NEON_2_SSE header, but I would wait for Victoria's feedback as she might have a very good reason to have those declarations there...

Zvictoria commented 4 years ago

Hi, @adahbingee . As for deprecated functions as @Bizonu says - they could be disabled by NEON2SSE_DISABLE_PERFORMANCE_WARNING But as for unused functions, the corresponding warning could be disabled by removing -Wunused-function flag from your compiler options, not in my header I believe. It is just about unused functions in your app using my header, not in the header itself... @Bizonu - I don't understand your suggestion to remove functions declaration from the header - the declaration is the function implementation itself... Could you please explain what do you mean?

Bizonu commented 4 years ago

I was referring to the fact that some of the NEON intrinsics are not implemented as functions, but as macros (see my example in previous messages, for the intrinsic vgetq_lane_p16). The thing is that for those intrinsics, even if they are implemented as macros, they still have the function declared (like in the example in the above comment)... I don't know why. Also there are some intrinsics that are not implemented (those using float16), that have the function declared, but not defined (implemented).

So all the unused-function warnings are generated by those function declarations that are not implemented... it has nothing to do with how the application uses NEON_2_SSE.h, because all the rest of the functions are defined as static inline. It could be just a simple application like this:

#define NEON2SSE_DISABLE_PERFORMANCE_WARNING
#include "NEON_2_SSE.h"

int main()
{
    return 0;
}

It should not generate warnings if we remove the declarations of the intrinsics that are implemented by macros or are not implemented at all.

This is what GCC says about this warning:

-Wunused-function

Warn whenever a static function is declared but not defined or a non-inline static function is unused. This warning is enabled by -Wall.

So my question in previous message was if those declarations are really needed. Maybe they are used by some static analysis tools?

Bizonu commented 4 years ago

I've done a quick fix for unused-function warnings on a branch, on my cloned repository, but I'm not sure if is OK to create a pull request for it...

I've just commented out all the declarations that I mentioned in the previous message. You will not receive any warnings if you compile the following code with gcc -Wall main.c:

#define NEON2SSE_DISABLE_PERFORMANCE_WARNING
#include "NEON_2_SSE.h"

int main()
{
    return 0;
}
Zvictoria commented 4 years ago

@Bizonu thanks for your work. As for the functions definitions/declarations as macros- they look the way they look because of the semi-automatic process of the functions prototypes generation used by me in process of this header creation. Doing it manually would have take ages, not months. I will review all your patches and accept them if everything is fine (all tests work etc). Stay tuned. Thanks again

Bizonu commented 4 years ago

Do you want me to do another pull request with the changes for unused-function ? Or to add the changes to the already created pull request ?

And by the way, thank you for developing this header! It saves a lot of time when prototyping code that runs on x86 and ARM. 👍

Zvictoria commented 4 years ago

No additions to the existing pr please... Just stay tuned. I will work on that ASAP.

adahbingee commented 4 years ago

In my understanding, it looks like -Wunused-function cannot be well solved? In fact, the NEON2SSE.h file is header to be included in cpp/c file.

Our project need to check in-project unused-function.

Closing unused-function will not only hide the NEON2SSE unused-function, but also hide in-project unused-function. That makes our project hard to find protential memory redundance.

#define NEON2SSE_DISABLE_PERFORMANCE_WARNING
#include "NEON_2_SSE.h"

void function_unused() // want to be exposed when compiling
{
}

int main()
{
    return 0;
}
Zvictoria commented 4 years ago

Do you want me to do another pull request with the changes for unused-function ? Or to add the changes to the already created pull request ? @Bizonu , yes, could you please create the pull request with this fix? I will merge it after some testing. Thanks!