I enabled Code Analysis for C++ from Visual Studio 2008 Team and I get a lot of warnings in strsafe.h.
This makes it very difficult to find the warnings that are specific to my source files. Is there a way for me to disable code analysis warnings that occur in the Microsoft SDK headers.
I am using the following versions.
- Visual Studio Team System 2008 trial edition version 9.0.21022.8 RTM.
- Microsoft Windows Software Development Kit (SDK) for Windows Server 2008 and .NET Framework 3.5Version 6.1
Below is a sample of the warnings code analysis generates.
1>c:\program files\microsoft sdks\windows\v6.1\include\strsafe.h(729) : warning C6387: 'argument 4' might be '0': this does not adhere to the specification for the function 'StringCopyWorkerA': Lines: 684, 686, 692, 694, 695, 697, 699, 701, 710, 727, 729
1>c:\program files\microsoft sdks\windows\v6.1\include\strsafe.h(770) : warning C6387: 'argument 1' might be '0': this does not adhere to the specification for the function 'StringExHandleOtherFlagsA': Lines: 684, 686, 692, 694, 695, 697, 699, 754, 756, 761, 764, 767, 770
Brett has the practical answer on suppressing the problem appended.
I will also note that this problem has been sent to the Windows SDK team and they are aware of the problems with strsafe.h not being prefast clean. We currently believe the header is ok, but that the analysis is being agressive because it can't determine enough information to make sure it's clean. Nevertheless, we are working on getting the header to not produce warnings.
Forwarded from Brett on our team:
I apologize for the delay in responding to your question. The easiest way to disable these warnings is to wrap your #include statements in the following construct: