Closed adahbingee closed 4 years ago
unused-function
is generated by code similar to:
_NEON2SSESTORAGE poly16_t vgetq_lane_p16(poly16x8_t vec, __constrange(0,7) int lane); // VMOV.s16 r0, d0[0]
#define vgetq_lane_p16 vgetq_lane_u16
I don't know why the function vgetq_lane_p16
needs to be declared if is actually a macro... There might be a good reason, but I don't see it at this moment.
deprecated-declarations
can be disabled by defining NEON2SSE_DISABLE_PERFORMANCE_WARNING
strict-aliasing
and sequence-point
are fixed in my pull requestGreat work!
Now only the unused-function
need to be solved.
Any suggestions?
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...
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?
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?
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;
}
@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
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. 👍
No additions to the existing pr please... Just stay tuned. I will work on that ASAP.
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;
}
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!
GCC 9.3.0 throws warnings
This is very agony when using warning as error in
-Wall -Werror