This is the mail archive of the gcc@gcc.gnu.org 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]

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


On Tue, 8 Sep 1998, Jeffrey A Law wrote:

>   > What if you worked for a company that required, as part of their coding
>   > style, warningless compilation?
> You explicitly select the warnings you decide are appropriate and
> make your code avoid such warnings.

And I do select them: "-Wall -Wstrict-prototypes" provides the warnings
that are appropriate.

> Anybody that uses -Wall blindly is bound to run into problems simply
> because the warnings that the egcs project decides are useful for -Wall are
> not necessarily those which everyone will consider useful for -Wall.
> 
> -Wall is a set of warnings that one particular group values, and to
> the extent that you share the same values -Wall will be useful.

I do share these values and I do find -Wall useful. However, some
(generally useful) warnings that -Wall enables do give false positives,
for example -Wunitialised (in the egcs 1.0.3a meaning, not the broken one
in 1.1b). You do acknowledge this fact and agree that the situation should
be improved, don't you? And, so far as I can see, the only way to improve
it is to add more fine-grained warning management code (apart from fixing
1.1b to bring -Wuninitialised code quality to the level of 1.0.3a).

I don't ask for anything new, every one of us has been using such features
for years.

Just think about "incompatible pointer type" warning. ANSI C compilers
warn about such practices, finding them, quite rightly, dangerous and
error prone. However, there are cases where such assignments are
necessary. Therefore, we've got the "cast" construction, that allows us to
say "I know what I'm doing here, it's fine, don't complain" - both to the
compiler and to another programmer looking at the source code. And it's
local, it applies to that single assignment only, all the other such
assignments will be warned, if appropriate.

Another example, more GCC related: __attribute__((unused)). Clearly, it's
the same concept: being able to disable a warning for a particular case.

Now, what I'm asking for is just a natural extension of this idea: if GCC
provides means to disable some warnings on case-by-case basis, why not for
all of them? From user's perspective, I really don't care if it's
implemented using pragmas, attributes or whatever else, if it uses warning
numbers or keywords, if warning strings are scattered all over the source
code or gathered in one place. I don't need warning hierarchy, for I don't
think that system header files should contain warning management code. I
don't mind the syntax being cryptic, for I intend to use the feature
rarely, the less often, the better.

> And yes, in my day job, I do deal with customers that requirewarning-
> less compilations out of gcc, as does Richard and everyone else in 
> Cygnus that's involved in gcc/g++ work.

And they don't come up with such ideas? I find it unbelievable. If people
offer you money and you still are so negative towards the idea, my hopes
of seeing such a feature in GCC are virtually gone :-(.

/ Kamil Iskra    AmigaOS  Linux/i386  Linux/m68k               \
| GeekGadgets GCC maintainer   UNIX system administrator       |
| iskra@student.uci.agh.edu.pl  kiskra@ernie.icslab.agh.edu.pl |
\ kamil@dwd.interkom.pl   http://student.uci.agh.edu.pl/~iskra /



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