[splint-discuss] [splint-discuss glib header and empty #define's

Michael Wojcik Michael.Wojcik at MicroFocus.com
Thu Feb 28 07:12:08 PST 2008


> From: splint-discuss-bounces at cs.virginia.edu 
> [mailto:splint-discuss-bounces at cs.virginia.edu] On Behalf Of 
> Jack T Mudge III
> Sent: Wednesday, 27 February, 2008 17:12
> Can you produce a small example that demonstrates the problem?
> 
> I feel like an idiot right now.

Don't. I'm sure most people on this list have plenty of experience with
mysterious problems that suddenly become clear when examined from a
different angle. Several times I've found things I overlooked while
trying to produce a testcase for some issue.
 
> I went to re-produce this error, with a file "test.c" containing
> #include <glib/glib.h>
> int main  {return 0;}
> (which is all I needed to cause the error before).
> Which I proceeded to (attempt to) compile using the command
> gcc -l glib-2.0 test.c 2>&1|less
> And my screen promptly filled with several pages of error messages.
...
> so I went to check what I might be forgetting, only to 
> find `pkg-config --cflags glib-2.0` hidden in my make file's CFLAGS 
> variable. Splint passes -I to the preprocessor, and the above backtick

> expression evaluates 
> to "-I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include" on my system.
> 
> That key oversight was apparently the source of this error.

Hmm. I wonder if you have multiple versions of the glibc headers on your
system? Maybe some with this issue, and some without?

Though, if you have Splint running successfully now, it's probably not
worth worrying about. You want Splint to check your code, not glibc's
(not enough time in the day to do that...), so it generally doesn't
really matter why a foreign header was causing trouble, if you can work
around it.

> Thank you for your help (and your insight into what that macro was
meant to 
> accomplish).

You'll see those C++ linkage macros in a lot of headers, as people
generally want their C APIs available to C++ programmers as well, so
it's something to be aware of.

-- 
Michael Wojcik
Principal Software Systems Developer, Micro Focus



More information about the splint-discuss mailing list