This is the mail archive of the
mailing list for the GCC project.
Re: Suppressing specific compiler warnings
- From: Paul Koning <pkoning at equallogic dot com>
- To: pinskia at physics dot uc dot edu
- Cc: llewelly at xmission dot com, shebs at apple dot com, dewar at gnat dot com, dutta at india dot hp dot com, gcc at gcc dot gnu dot org, rmathew at gmail dot com
- Date: Fri, 28 May 2004 09:05:51 -0400
- Subject: Re: Suppressing specific compiler warnings
- References: <firstname.lastname@example.org><200405272111.i4RLBKM20817@tin.geop.uc.edu>
>>>>> "Andrew" == Andrew Pinski <email@example.com> writes:
>> GCC has a few warning flags, such as -Weffc++, whose utility is
>> strongly dependent on the style the code is written in, and a few
>> others, such as -Wunitialized, which are usually desireable, but
>> sometimes need to be turned off when one has an unusual need, such
>> as avoid unecessary initialization of a multi-megabyte array which
>> is going to be filled with input.
Andrew> But -Wuninitialized does not warn for arrays. Also I was
Andrew> talking about turning off warnings in the source it self
Andrew> rather than by flags.
How are the two different? If you think that turning off warnings is
wrong, it doesn't matter which tool you use to do so.
I agree with DJ that this is an unreasonable view, and you do need to
be able to turn off warnings. That being the case, doing it in source
is often better. It can be finer grained, and in some large systems
the makefile structure is such that per-file flags control isn't
available. So you may end up disabling a warning for thousands of
sources when you really just wanted to disable it for a portion of one
Sometimes you need to disable warnings to work around tool bugs. Not
all warnings are coding errors in the application.