roustk wrote:
> Actually, having just tried this, -pedantic doesn't seem to do it. I
now
> get warnings about C++ style comments, but nothing more. I'll play
> with Shanoah's full list, though. (Pointer arithmetic is bad? We're in
> trouble...)
Just a quick summary of the warnings enabled there, and why you do or
don't want to use the options (all IMO obviously)...
-pedantic is a good one if you want your code to be ****table. Without
it, you're not going to get warned about various actually illegal (in
the sense of non-standard) constructions.
-Wall turns on a whole load of mostly useful warnings - particularly
warnings of possible initialised variables, unused "static" functions,
and so on.
-Wextra turns on a few warnings such as -Wmissing-parameter-type and
-Wold-style-declaration that can be useful sometimes, but also a couple
of no particular use, and one you really want to turn off (see
missing-field-initializers).
-Wpointer-arith is already enabled by -pedantic, but is useful as it
doesn't warn of all pointer arithmetic, just relying on sizeof(void) and
similar non-standard things.
-Wc++-compat would be useful if you had some reason to write code
compatible with C++ I suppose, but that's not true of most programs, and
certainly isn't true of Angband.
-Wcast-qual is pointless - there are times when you want a function to
take a "const char *" for instance to tell the caller that you won't
modify the contents of the pointed-to thing, but it's useful to cast
away the const to avoid the genuinely useful warning about implicitly
discarding it. The presence of the cast should be enough warning for
anyone reading the code to be careful what they're doing. Enable it
sometimes if you want, but only to highlight them to be checked in a
code audit, not in a regular build.
-Wmissing-field-initializers is turned on by -Wextra (or used to be
anyway) and is actively undesirable. The pain caused by initialising
every field of every structure/union is far greater than the pain caused
by possibly forgetting to initialise something you meant to. The
shorthand is there because it's useful, especially if you're extending a
data structure with an optional field at the end. :)
So if you're looking for more warnings, I'd say you'd be best off with
"-ansi -pedantic -Wall -Wextra -Wno-missing-field-initializers
-Wno-unused-parameter". For everyday builds anyway. :)
--
Antony "Not the maintainer" Sidwell


|