I have the following example code and would like to know what kind of annotations I can use to avoid them.
int Function(classA* pInput) {
if (pInput == NULL) {
classA::Create(pInput);
}
return pInput->value;
}
The problem is that since Prefast evaluates only the function it doesn't know that Create
initializes the pointer.
I thought I could solve it by using the __out
annotation in the header file for classA::Create
however that didn't work.
I'm wondering if there is a good alternative to just __analysis_assume
everywhere in the code such that prefast picks it up from the function definition.
Secondly, I was wondering how would I set up my build configuration so that I can build my code natively on Linux or with GCC with these preprocessor directives. Would I have to check if it's on a LINUX build and then add those annotations as empty Macros?