02-18-2017 06:47 AM
Hello,
Compiling my project, I receive lots of warnings from .h files that are delivered with CVI or other modules.
I'd like to focus on "my" warnings but they are in the flow and I can miss some.
Is there a way to say clang compiler (or CVI interface) to hide the warnings from files not in the project directory (#include <thefile.h< as eg)?
02-22-2017 04:44 AM - edited 02-22-2017 04:46 AM
Hello,
You can disable only individual warnings, but not all warnings with a single statement, using this:
#if defined (__clang__) #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wundef" ... #pragma clang diagnostic ignored "-Wunknown-pragmas"
#endif // __clang__
#include <thefile.h.h>
#if defined (__clang__) #pragma clang diagnostic pop
#endif // __clang__
02-22-2017 05:40 AM
If I understand, we have to disabling all the warnings, warning per warning, file per file.
It is one solution but not so easy to implement when several files are in the project.
To be tested.
02-22-2017 05:43 AM
That's right. If there are many warnings this solution is not very usable
02-22-2017 05:48 AM
The warnings I have are
===
"Windows.h"(213,1) In file included from C:\Program Files (x86)\National Instruments\Shared\MSDTRedistributables\SDKHeaderFiles\8.1\windows.h:213:
"windef.h"(24,1) In file included from C:\Program Files (x86)\National Instruments\Shared\MSDTRedistributables\SDKHeaderFiles\8.1\windef.h:24:
"minwindef.h"(182,1) In file included from C:\Program Files (x86)\National Instruments\Shared\MSDTRedistributables\SDKHeaderFiles\8.1\minwindef.h:182:
"winnt.h"(5320,19) warning: cast from function call of type 'LONG' (aka 'long') to non-matching type 'PVOID' (aka 'void *')
"winnt.h"(5345,19) warning: cast from function call of type 'LONG' (aka 'long') to non-matching type 'PVOID' (aka 'void *')
"winnt.h"(8682,19) warning: cast from function call of type 'LONG' (aka 'long') to non-matching type 'PVOID' (aka 'void *')
"winnt.h"(8693,19) warning: cast from function call of type 'LONG' (aka 'long') to non-matching type 'PVOID' (aka 'void *')
"winnt.h"(8704,19) warning: cast from function call of type 'LONG' (aka 'long') to non-matching type 'PVOID' (aka 'void *')
25, 1 In file included from d:\Workspaces\W60_brancheIFM_P1UOArr\DllBanc\Adam4050.c:25:
"DefGlob.h"(40,1) In file included from d:\Workspaces\W60_brancheIFM_P1UOArr\DllBanc\DefGlob.h:40:
"Windows.h"(214,1) In file included from C:\Program Files (x86)\National Instruments\Shared\MSDTRedistributables\SDKHeaderFiles\8.1\windows.h:214:
"WinBase.h"(7120,5) warning: 'TpInitializeCallbackEnviron' was marked unused but was used
"WinBase.h"(7130,5) warning: 'TpSetCallbackThreadpool' was marked unused but was used
"WinBase.h"(7141,5) warning: 'TpSetCallbackCleanupGroup' was marked unused but was used
"WinBase.h"(7150,5) warning: 'TpSetCallbackLongFunction' was marked unused but was used
"WinBase.h"(7160,5) warning: 'TpSetCallbackRaceWithDll' was marked unused but was used
"WinBase.h"(7172,5) warning: 'TpSetCallbackPriority' was marked unused but was used
"WinBase.h"(7183,5) warning: 'TpSetCallbackPersistent' was marked unused but was used
"WinBase.h"(7192,5) warning: 'TpDestroyCallbackEnviron' was marked unused but was used
===
02-22-2017 05:52 AM
Those don't seem to be a high number of warnings. If you want to see the warning ID you can check "Show warning flags in Build Output window" in Options>>Build Options and rebuild the project.
If you include windows.h in many files you can create a new header file that includes windows.h and with the warning disabling pragmas around and include this new file
02-22-2017 05:52 AM
at least some of your warnings have been marked for a corrective action
02-22-2017 05:58 AM
This list in almost of the project files generates lots of item in window.
02-22-2017 03:37 PM
so, we have to wait for a future update of the SDK.
Why do you deliver .h that creates false warnings? isn't it validated prior to validation?