[splint-discuss] check if type is struct pointer

Matuschka, Sebastian Sebastian.Matuschka at gcd-solutions.de
Thu Aug 30 00:21:24 PDT 2007


Hello,

in the splint source code(ctype.c) ctype_getBaseType() there is only a
switch clause for array pointers:
######code start#######
ctype
ctype_getBaseType (ctype c)
{
  ctentry cte = ctype_getCtentry (c);

  switch (ctentry_getKind (cte))
    {
    case CTK_UNKNOWN:
    case CTK_INVALID:
    case CTK_PLAIN:
      return c;
    case CTK_PTR:
    case CTK_ARRAY:
      return (ctype_getBaseType (ctype_baseArrayPtr (c)));
    case CTK_COMPLEX:
      {
       ...
######code end#######

but how can i recogize a struct pointer?
i have code (which splint should test) like:
######code start#######
//structures
typedef struct {
	int iSTest1;
	unsigned char ucSTest2;
	long lTest;
}StrutSplintT2;

struct strTest{
	int iBlab;
};

struct strTest2
{
	int iAbalkd;
}

struct StrutSplintT2 *pointerstrTest;
######code end#######

ctype_isStruct() says pointerstrTest is no struct, ctype_isPointer()
says it is a pointer, thats ok.
is there any other way to check if an uentry or ctype is a struct
pointer?
i could parse the string which is returned by ctype_unparse(), but thats
not really a solution for me.
maybe someone has an idea?
Cheers
Sebastian





More information about the splint-discuss mailing list