LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

hide warnings from external files

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)?

0 Kudos
Message 1 of 9
(3,639 Views)

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__

 

0 Kudos
Message 2 of 9
(3,569 Views)

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.

0 Kudos
Message 3 of 9
(3,563 Views)

That's right. If there are many warnings this solution is not very usable

0 Kudos
Message 4 of 9
(3,561 Views)

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

===

0 Kudos
Message 5 of 9
(3,559 Views)

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

0 Kudos
Message 6 of 9
(3,553 Views)

at least some of your warnings have been marked for a corrective action

0 Kudos
Message 7 of 9
(3,552 Views)

This list in almost of the project files generates lots of item in window.

0 Kudos
Message 8 of 9
(3,549 Views)

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?

 

0 Kudos
Message 9 of 9
(3,538 Views)