Closed Bizonu closed 4 years ago
Hi, @Bizonu. I've revisited this pull request. And.....Sorry looks like we need to look for some other solution to eliminate these macro-implemented functions. It looks so good and logical when first all functions prototypes are listed without any commenting or something and then go their implementations (where prototypes commenting is more than fine). Will need more time to look into that. Probably there is a way to disable gcc warning for this exact header only?
I think that the only way to really fix those warnings and keep the declarations of the functions is to actually implement inline functions for all the intrinsics that are now implemented by macros. That would be a huge task and I'm not sure at the moment if it will not add other warnings...
Personally, I don't mind those kind of warnings as I usually can disable them... but there are some people working on projects that forbids disabling warnings (or even enables all the warnings to be treated as errors)... for example most automotive related projects have all the warnings to be reported as error.
For the moment, if you like, we can close this pull request... maybe we will find a more elegant solution in the future or I will find time to implement inline functions for all the intrinsics implemented as macros...
Hi, Bizonu While I’m not GCC expert, it is not the main compiler I use daily, the quick search shows warnings disabling for some code part is possible in gcc https://stackoverflow.com/questions/3378560/how-to-disable-gcc-warnings-for-a-few-lines-of-code I’d be happy if you implement this kind of solution rather than the one proposed by you in this PR. Thanks in advance!
Victoria
From: Bizonu notifications@github.com Sent: 3 апреля 2020 г. 16:11 To: intel/ARM_NEON_2_x86_SSE ARM_NEON_2_x86_SSE@noreply.github.com Cc: Subscribed subscribed@noreply.github.com Subject: [intel/ARM_NEON_2_x86_SSE] bugfix/unused function (#42)
As discussed in issue #40https://github.com/intel/ARM_NEON_2_x86_SSE/issues/40, this pull requests solves the unused-function warnings generated by GCC, by commenting the function declarations for intrinsics that are implemented using a macro.
Also it fixes two overflow warnings reported by GCC when compiled with -pedantic flag.
You can view, comment on, or merge this pull request online at:
https://github.com/intel/ARM_NEON_2_x86_SSE/pull/42
Commit Summary
unused-function
warnings.-Woverflow
warnings when -pedantic
flag is used.File Changes
Patch Links:
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/intel/ARM_NEON_2_x86_SSE/pull/42, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AFRCTF37C744TVH3DJCHJOTRKXN6FANCNFSM4L37TKVA.
Joint Stock Company Intel A/O Registered legal address: Krylatsky Hills Business Park, 17 Krylatskaya Str., Bldg 4, Moscow 121614, Russian Federation
This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.
Unfortunately on GCC those pragma
are not useful. On Clang it does the job.
The thing is that GCC observes that those functions are not defined only when it reaches the end of the compile for the C/CPP file that includes the header:
#pragma GCC diagnostic ignored "-Wunused-function"
it will work, but it will disable that warning for the entire compile unit (entire C/CPP file that includes NEON_2_SSE.h).#pragma GCC diagnostic push
and #pragma GCC diagnostic ignored "-Wunused-function"
at the begining of the header and #pragma GCC diagnostic pop
at the end of the header, it will not work#define _NEON2SSESTORAGE __attribute__((unused)) static
, it will not work as this attribute works only for unused functions that are defined (implemented), but our functions are only declared.So really I don't know how to resolve this for GCC... at least it seems to work for Clang!
It seems I just found something...
If we remove _NEON2SSESTORAGE
from the declaration of the functions that are not implemented, we will also remove the warning (the issue seems to be only for functions declared as static, but not implemented).
So we just need to replace for example:
_NEON2SSESTORAGE uint16x4_t vadd_u16(uint16x4_t a, uint16x4_t b); // VADD.I16 d0,d0,d0
with
uint16x4_t vadd_u16(uint16x4_t a, uint16x4_t b); // VADD.I16 d0,d0,d0
But this change needs to be done only for the functions that are not implemented.
So do you think that this will be acceptable as a solution ?
Please see the last commit as it fixes all the warnings and I think that is an elegant solution.
Hi, @Bizonu. I've undone your PR due to users complain on errors in case of USE_SSE4 enabled. Could you please look at it for all cases (USE_SSE4 and all other conditional defines found :) ) and re-submit your commit with fixes and this feature (unused functions warning fix only)
As discussed in issue #40, this pull requests solves the
unused-function
warnings generated by GCC, by commenting the function declarations for intrinsics that are implemented using a macro.Also it fixes two
overflow
warnings reported by GCC when compiled with-pedantic
flag.