RE: Sample Program for Code Analysis Tool

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



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.


.



Relevant Pages

  • Re: Cant add a root Certificate in Vista RC2
    ... Seems surprising that you don't get that warning message. ... a certificate from a certification authority that claims to ... Microsoft Online Community Support ... where an initial response from the community or a Microsoft Support ...
    (microsoft.public.platformsdk.security)
  • I encounter the same error, but my data does not have the benefit of record tags.
    ... Microsoft Online Community Support ... You can send feedback directly to my manager at: ... where an initial response from the community or a Microsoft Support ... I am having trouble creating one input flat file. ...
    (microsoft.public.biztalk.general)
  • Re: System Error (1003) - 0x000000CB
    ... MCSE, CCEA, Microsoft MVP - Terminal Server ... A call to Microsoft Support seems appropriate. ... Computer: TERMSERVER1 ...
    (microsoft.public.windows.terminal_services)
  • Re: How do I Sleep for a specified amount of time and relinquish c
    ... Finally, the Windows thread scheduling is not a trivial topic, it is ... Microsoft Online Community Support ... where an initial response from the community or a Microsoft Support ...
    (microsoft.public.dotnet.framework)
  • RE: WSE910 error due to time zone differences between client/serve
    ... synchronization problem between service client and server. ... timestamp header in the form of UTC time format. ... Microsoft MSDN Online Support Lead ... where an initial response from the community or a Microsoft Support ...
    (microsoft.public.dotnet.framework.webservices.enhancements)