Avoiding compiler warnings

Joseph S. Myers joseph@codesourcery.com
Fri Aug 17 20:10:00 GMT 2012


On Fri, 17 Aug 2012, Marek Polacek wrote:

> With trunk gcc I'm seeing a few -Wstrict-aliasing warnings, two
> -Wstrict-aliasing and two -Wformat warnings (x86_64).  So we'd need to
> fix these...

You could start with -Werror -Wno-error=strict-aliasing as the default.  
(-Wformat warnings really should be fixed in all cases; some other 
warnings may be more liable to false positives that are harder to fix.)

> However, with --enable-all-warnings, there are tons of various
> warnings coming from e.g. -Wcast-qual, -Wsign-compare, etc.  So it'd be
> impossible to use those two together.

I'm a bit doubtful of the use of --enable-all-warnings.  I'd probably say 
that each of the extra warning options in there could be added to the 
default warnings individually - if the fixes required for the warnings 
shown up by that option seem reasonable.  Some of the extra warnings are 
in -Wall anyway.

-- 
Joseph S. Myers
joseph@codesourcery.com



More information about the Libc-alpha mailing list