[splint-discuss] glib header and empty #define's
Jack T Mudge III
jakykong at theanythingbox.com
Tue Feb 26 15:19:00 PST 2008
Greetings!
This is my first message on this list. I've never used splint before
(although I just finished perusing the manual somewhat, and the program
appears enticing enough to be worth some work).
I'm developing a small program to help me organize my homework a bit, and
thought I'd give splint a try with it. Created some source code that
compiles and runs flawlessly, but can't get past the glib header file
(parse error). I realize one option is to skip the header file alltogether,
but splint complains about unknown identifiers, and dies when I try to
treat an int (which was defined as a GString, but defaulted to int when
splint didn't know what a GString was, apparently) as a struct, and try to
dereference it.
I did some hunting, and I'm pretty sure I narrowed the problem down to this:
in /usr/include/glib-2.0/glib/gmacros.h
/* Guard C code in headers, while including them from C++ */
#ifdef __cplusplus
# define G_BEGIN_DECLS extern "C" {
# define G_END_DECLS }
#else
# define G_BEGIN_DECLS ;
# define G_END_DECLS ;
#endif
This file is included by every other header in the glib library, in this
case specifically in /usr/include/glib-2.0/glib/gtypes.h (which I included
in my source file). The point of this snippet seems to be to keep some
declarations from causing problems for C++ compilers, which is fine. I
generally don't use C++, so I'm not as familiar with some of these idioms.
The definition G_BEGIN_DECLS and G_END_DECLS, then, should be "" in my
source file -- __cplusplus is NOT defined. However, splint feeds me this
error instead of skipping over it (since a blank definition does nothing):
/usr/include/glib/gtypes.h:41:8: Parse Error: Non-function declaration:
G_BEGIN_DECLS : int. (For help on parse errors, see splint -help
parseerrors.)
I have tried adding #define G_BEGIN_DECLS ; to my source file, and splint
complains about a duplicate definition (so apparently it's getting to the
definition in the first place). Unfortunately, I'm out of ideas except for
removing this code from my header files (since I'm not using C++, it
shouldn't do any harm to do that, but it seems drastic to me).
Does anyone have some ideas as to how to get splint past these defines?
--
Sincerely,
Jack Mudge
jakykong at theanythingbox.com
My GPG Public Key can be found at:
https://www.theanythingbox.com/pgp.htm and Below.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://www.cs.virginia.edu/pipermail/splint-discuss/attachments/20080226/e597883d/attachment.bin
More information about the splint-discuss
mailing list