Code Vigorous


navigation
home
github
mozillians
email
about
Dustin J. Mitchell

GCC warnings

21 Dec 2009

I love the fact that GCC has basically eliminated the need to run lint, by adding every imaginable warning. But there are two problems.

First, generated code (at this point I’m being bitten by code generated by rpcgen for NDMJOB) seldom runs without warnings. Usually these are the “unused XXX” warnings, but some generated code is really and truly broken - K&R style definitions, signed/unsigned confusions, the works.

Second, warnings come and go between GCC versions, so just because it runs fine on my system does not mean it will run fine on all of the GCC’s Amanda gets built on (never mind any other compilers!). Here’s where I find myself trying to figure out how to disable a particular bogus warning for some ancient version of gcc, which is naturally not in the manuals now available on the web. And here’s where my favorite GCC trick is handy: -fdiagnostics-show-option will cause gcc to display the -W option that controls that particular warning. From there, you can google the warning, or just disable it if you’ve determined that it’s spurious and not worth the code changes required to make it go away.

I thought I’d throw that up here so I don’t forget about it again.