[splint-discuss] [Beginner] Glib data structures not detected as freed

Jeff Johnson n3npq at mac.com
Sat Jan 24 06:18:02 PST 2009


On Jan 24, 2009, at 8:50 AM, Stephane Bortzmeyer wrote:

> On Wed, Jan 14, 2009 at 08:15:14AM -0500,
> Jeff Johnson <n3npq at mac.com> wrote
> a message of 158 lines which said:
>
>> Try this
>> 	/* Repeat the prototype with annotations */
>> 	GList *g_list_delete_link(/*@only@*/ GList * list,
>>                                  GList * link_)
>> 	            /*@modifies list @*/ ;
>
> Hmmm, no, sorry, splint is not happy:
>
> test-glib-splint.c:21:39: Parameter list inconsistently redeclared  
> as only
>    storage, previously declared as implicitly temp storage
>  A function, variable or constant is redefined with a different  
> type. (Use
>  -incondefs to inhibit warning)
>   /usr/include/glib-2.0/glib/glist.h:74:60: Declaration of list
>

Retrofitting annotations onto existing system prototypes usually
requires
	/*@-incondefs@*/
	...
	/*@=incondefs@*/
around the retrofitted prototype.

The other approach is to disable -incondefs globally when running  
splint. In my
experience, splint warnings about inconsistently defined
prototypes are more "stuff" than I'm usually interested in.

> The glist.h contains:
>
> GList*   g_list_delete_link             (GList            *list,
> 					 GList            *link_) G_GNUC_WARN_UNUSED_RESULT;
>
> For a full context, I attached the C source I use. It compiles without
> gcc warnings and runs fine but I would like to be able to check it
> with splint.

If you want "real world" examples of how to deal with many
splint issues, try looking at RPM sources from @rpm5.org. I've been
using splint for years with RPM, and there are various retrofits to
many splint issues.

73 de Jeff
>
> <test-glib-splint.c>_______________________________________________
> splint-discuss mailing list
> splint-discuss at mail.cs.virginia.edu
> http://www.cs.virginia.edu/mailman/listinfo/splint-discuss

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4664 bytes
Desc: not available
Url : http://www.cs.virginia.edu/pipermail/splint-discuss/attachments/20090124/8e119e63/attachment.bin 


More information about the splint-discuss mailing list