RE: Sample Program for Code Analysis Tool
- From: beth_123@xxxxxxxxxxxxxxx <beth_123@xxxxxxxxxxxxxxx>
- Date: Mon, 21 Aug 2006 09:53:02 -0700
Gary,
Thanks for your research and investigation. The demo is now working as
documented.
However, now I have another question:
Using the same demo, I wanted to try the "MustCheck" property. I changed
annotation.h line 11 to use MustCheck instead of Null, so it now looks like
this
[returnvalue:SA_Post( MustCheck=SA_Yes )] LinkedList* AllocateNode();
I expected to see warning 6031 about the return value not being checked.
I'm not getting that warning. Now what am I not understanding? Shouldn't
it give a warning? Why isn't it?
Thanks.
Beth
Here's the code I'm using in annotation.c
#include <CodeAnalysis/SourceAnnotations.h>
#include <windows.h>
#include <stdlib.h>
#include "annotation.h"
[returnvalue: SA_Post (Null=SA_Maybe)] LinkedList* AddTail
( [SA_Pre(Null=SA_Maybe)] LinkedList* node, int value)
{
LinkedList *newNode = NULL;
if (node == NULL)
return NULL;
// finds the last node
while ( node->next != NULL )
{
node = node->next;
}
// appends the new node
newNode = AllocateNode();
newNode->data = value;
newNode->next = 0;
node->next = newNode;
return newNode;
}
""Gary Chang[MSFT]"" wrote:
Hi Beth,.
error C3115: 'PostAttribute': this attribute is not allowed on 'AddTail'
Does this feature really work or am I doing something wrong?
I have downloaded that demo sample and perform some research on it, I found
the above error would occur if you don't specify the "returnvalue:" keyword
to the post attribute when it applies to a return value. So in the demo
sample project, there are 2 places to specify the "returnvalue:"
//annotation.h, Line 11:
[returnvalue:SA_Post( Null=SA_Maybe )] LinkedList* AllocateNode();
//annotation.c, Line 5:
[returnvalue: SA_Post (Null=SA_Maybe)] LinkedList* AddTail
([SA_Pre(Null=SA_Maybe)] LinkedList* node, int value)
The MSDN walkthrough obviousely missed the second place. :(
Thanks for your understanding!
Best regards,
Gary Chang
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
- Follow-Ups:
- RE: Sample Program for Code Analysis Tool
- From: "Gary Chang[MSFT]"
- RE: Sample Program for Code Analysis Tool
- References:
- Sample Program for Code Analysis Tool
- From: beth_123@noemail.noemail
- RE: Sample Program for Code Analysis Tool
- From: "Gary Chang[MSFT]"
- Sample Program for Code Analysis Tool
- Prev by Date: Re: Memory Leak Issue
- Next by Date: RE: Sample Program for Code Analysis Tool
- Previous by thread: RE: Sample Program for Code Analysis Tool
- Next by thread: RE: Sample Program for Code Analysis Tool
- Index(es):
Relevant Pages
|