[splint-discuss] Warnings when using g_assert
Jeremy Cowgar
jeremy at cowgar.com
Wed Oct 11 07:18:15 EDT 2006
When I use g_assert:
g_assert (g_file_test ("config.ini", G_FILE_TEST_EXISTS) == 0);
I get 3 warnings:
main.c:16:6: Test expression for if not boolean, type int: 1
Test expression type is not boolean or int. (Use -predboolint to
inhibit
warning)
main.c:16:103: Null storage passed as non-null param: g_log (((gchar
*)0), ...)
A possibly null pointer is passed as a parameter corresponding to
a formal
parameter with no /*@null@*/ annotation. If NULL may be used for
this
parameter, add a /*@null@*/ annotation to the function parameter
declaration.
(Use -nullpass to inhibit warning)
main.c:16:345: Statement has no effect: (void)0
Statement has no visible effect --- no values are modified. (Use -
noeffect to
inhibit warning)
All three of these warnings are warnings I cannot do anything about w/
o altering glib code, which I obviously do not want. I can disable
these checks via command line switches, but I don't want to because I
want to be able to detect these problems in my own code. Is there
another way of causing these warnings not to appear? I tried all
sorts of things about not expanding macros with prefix g_, etc... but
I couldn't get these messages to go away. I am running splint like:
splint $(INCLUDES) -sys-dirs /usr/include:/sw/include *.c
glib.h and it's variants are located under /sw/include.
Thanks.
Jeremy
More information about the splint-discuss
mailing list