Edit

Share via


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.

Remarks

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

Code analysis name: NO_PROPERTIES_ON_ATTRIBUTE

Example

The following code generates this warning because Deref=1 only specifies the level of indirection, but this information alone doesn't 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);