This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Suppressing specific compiler warnings

>>>>> "Andrew" == Andrew Pinski <> 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
of them.

Sometimes you need to disable warnings to work around tool bugs.  Not
all warnings are coding errors in the application.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]