Warnings in the C++ Front-End and GCC in General

james.g.mansion@hsbcgroup.com james.g.mansion@hsbcgroup.com
Thu Sep 10 19:06:00 GMT 1998

These suggestions are inadequate.

I want to disable warnings *in  certain contexts* only.

This is particularly important wrt suppressing warnings resulting from
template instantiation where I know that the domains of
values involved mean that the warnings are harmless (also applies to any
cast related warnings etc).

This NOT just an issue of warnings relating to dubious system headers (or
headers from third party vendors).

And I regard it as inadequate to say that, if I wish to disregard a
particular warning about possible data loss (typically from a
signed/unsigned conversion) in a particular use of a template, that I
should lose all instances of that warning, or
that I should lose all instances of that warning relating to the template
header file.

The context cannot be described in terms of the header that defined the
template - only a range of lines in the translation unit
concerned.  Given that edits may change the absolute line numbers, its
necessary to put the control at the point where its needed,
not externally in scripts or command line configurations etc.

I would agree that it would be useful to be able to influence what the
compiler treats as a 'system header file' for the purpose of
overall suppression of problems in them, however.

I don't know what the fuss about the numbers is as far as it being a
problem for the maintainers and subject to change in a way
that may cause users problems - the numbers have been rather stable in VC++
since v4 for example and have not caused me
any problems.


Branko Cibej <branko.cibej@hermes.si> on 09/09/98 21:12:14

To:   egcs@cygnus.com
cc:   mark@markmitchell.com (bcc: James G MANSION/HBMD/HSBCMERIDIAN)
Subject:  Re: Warnings in the C++ Front-End and GCC in General

Richard Hadsell wrote:
> ... Using SGI's C++ and DEC's C++ I can
> disable warnings that appear as a result of system or vendor headers,
> over which I have no control.
Klaus-Georg Adams wrote:
> I think the ability to disable warnings in the source code is very
> valuable, because often they come from system header files you can't
> change (or from a questionable default setting, like e.g. g++'s
> -Wctor-dtor-privacy). ...
The question that comes to mind here is, how often do you want to disable
warning from code that you _do_ control? I've been bitten by warnings from
system headers myself, but I prefer to remove warnings generated by my own
code by changing it, not by simply disabling the warning.
So, to begin with, why not add an option to disable all warnings from
specific headers; e.g., system headers, or all headers in a specific
directory? As a matter of fact, I submitted a patch a few months ago which
added a -Wno-system-headers option, but it didn't make it into egcs. I
it would be easy enough to generalize the idea, and I'd be willing to try
Branko Cibej   <branko.cibej@hermes.si>
HERMES SoftLab, Litijska 51, 1000 Ljubljana, Slovenia
phone: (++386 61) 186 53 49  fax: (++386 61) 186 52 70

This message originated from the Internet. Its originator may, or may
not be who they claim to be, and the information contained herein
may, or may not be accurate.

Midland Bank plc, who is regulated in the UK by SFA, has issued the
information contained in this message (including any attached documents)
for its non-private customers only. It should not be reproduced and/or
distributed to any other person. It is not an invitation to buy or sell
securities. Opinions may change without notice and members of the 
HSBC Group may have positions in, or trade in instruments mentioned in
this message. Each page attached hereto must also be read in conjunction
with any disclaimer which form part of it.

More information about the Gcc mailing list