次の方法で共有


C6516

Note

This article applies to Visual Studio 2015. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

warning C6516: invalid annotation: no properties specified for <name> attribute

Note

This warning occurs only in code that is using a deprecated version of the source-code annotation language (SAL). We recommend that you port your code to use the latest version of SAL. For more information, see Using SAL Annotations to Reduce C/C++ Code Defects.

This warning indicates that either no property was specified in the attribute or the property that was specified is invalid; therefore, the attribute cannot be considered complete.

Example

The following code generates this warning because Deref=1 only specifies the level of indirection, but this information alone does not help the analysis tool:

// C  
#include <CodeAnalysis\SourceAnnotations.h>  
void f([SA_Pre(Deref=1)] char* pc);  
  
// C++  
#include <CodeAnalysis\SourceAnnotations.h>  
using namespace vc_attributes;  
void f([Pre(Deref=1)] char* pc);  
  

To correct this warning, another property, such as Access, is required to indicate to the analysis tool what must be enforced on the de-referenced items. The following code corrects this warning:

// C  
#include <CodeAnalysis\SourceAnnotations.h>  
void f([SA_Pre(Deref=1, Access=SA_Read)] char* pc);   
  
// C++  
#include <CodeAnalysis\SourceAnnotations.h>  
using namespace vc_attributes;  
void f([Pre(Deref=1, Access=Read)] char* pc);