C6517
The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.
The latest version of this topic can be found at C6517.
warning C6517: Invalid annotation: 'SAL_readableTo' property may not be specified on buffers that are not readable: '_Param_(1)'.
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 SAL_readableTo property does not have the required read access. You cannot use this property to annotate a parameter without providing read access.
The following code generates this warning because read access is not granted on the buffer:
#include <CodeAnalysis\SourceAnnotations.h> using namespace vc_attributes; void f([Pre( ValidBytesConst=10 )][Pre( Deref=1, Access=Write )] char* buffer );
To correct this warning, grant read access as shown in the following code:
#include <CodeAnalysis\SourceAnnotations.h> using namespace vc_attributes; void f([Pre( ValidBytesConst=10 )][Pre( Deref=1, Access=Read)] char* buffer );