[splint-discuss] Set that pointer defines

AlannY m at alanny.ru
Fri Jan 15 04:28:21 PST 2010


Hi there. I have minor problem with pointers.

I have a function, say, some_function, with param with /*@out@*/ annotation:

    void
    some_function (/*out*/ /*only*/ /*null*/ void *ptr)
    {
    }

In the body, I'm calling another function, which checks if ptr defined. Later, if ptr is not defined,
some_function returns.

    if (check_ptr(ptr)==0)
      return;

After that, as you can see, ptr defined and I'm working with this defined pointer.

Splint tells me, that ptr is not defined.

    my_file.c:000:00: Passed storage ptr not completely defined (*ptr is undefined):
                  memcpy (..., ptr, ...)
  Storage derivable from a parameter, return value or global is not defined.
  Use /*@out@*/ to denote passed or returned storage which need not be defined.
  (Use -compdef to inhibit warning)

How to tell splint that, check_ptr function check if ptr defined and if not - returns, so it's impossible
to use ptr after check.

Thank you.

-- 
   )\._.,--....,'``.
  /,   _.. \   _\  (`._ ,.
 `._.-(,_..'--(,_..'`-.;.' 


More information about the splint-discuss mailing list