Jocris Bitoon - 2016-09-19

Hello,

I created the ff. configuration file:

<def> <podtype name="PtrType1" sign="u" size="2"/> <podtype name="PtrType2" sign="u" size="3"/> </def>

After creating this, CPPCheck was able to identify if a variable of type PtrType1 or PtrType2 was unused.
Both PtrType1 and PtrType2 is a define based on the "unsigned char*".
Their only difference is the range of values they can accomodate.

However, is it also possible for CPPCheck to flag an error/warning for the scenario below?

void func1(PtrType1 param1)
{
//function body...
}

int main()
{
PtrType2 ptrvar;

ptrvar = <some value="">;

func1(ptrvar);
return 0;
}

To flag a warning regarding the implicit conversion of one pointer to another would be nice. This is so that CPPCheck can help us in our manual checking of the usage of these 2 pointers. I would also like for CPPCheck to be able to flag a warning if the call to func1() happens to be:

func1((PtrType1)ptrvar);