A summary of what has been proposed so far to clean up Wextra follows.
Please, your feedback is appreciated. And reviewing patches even more
;-)


* Subscripting an array which has been declared register.
* Taking the address of a variable which has been declared register.

Proposed: new option -Waddress-of-register that is enabled by Wextra.
A patch is available here:
http://gcc.gnu.org/ml/gcc-patches/2006-12/msg01676.html


* A base class is not initialized in a derived class' copy constructor.

Proposed: move this warning to -Wuninitialized seems the appropriate
solution. However, I am afraid that this warning will turn out to be
too noisy and hard to avoid to be in Wuninitialized (see PR 11159).
Perhaps a new option -Wuninitialized-base-class enabled by -Wextra
would be better if that PR cannot be easily fixed.


* A non-static reference or non-static const member appears in a class
without constructors.

Proposed: move this warning to -Wuninitialized


* Ambiguous virtual bases (virtual base inaccessible due to
ambiguity).

Proposed: move this warning to -Woverloaded-virtual


* An enumerator and a non-enumerator both appear in a conditional
expression.

Proposed: move this warning to (the new) -Wconversion


* A function can return either with or without a value.

This is warned already by Wreturn-type: "'return' with no value, in
function returning non-void" and I wasn't able to come up with a
testcase that is warned by Wextra but not by Wreturn-type.

Proposed: move to Wreturn-type whatever is not there yet.


* An expression-statement or the left-hand side of a comma expression
contains no side effects. For example, an expression such as x[i,j].

This is also warned by Wunused-value. In addition, Wextra enables
Wunused-value but this is not documented (and -Wunused-value is
already enabled by -Wall).

Proposed: Wextra should not enable Wunused-value. Patch:
http://gcc.gnu.org/ml/gcc-patches/2007-01/msg00440.html


* A pointer is compared against integer zero with <, <=, >, or >=.
This is a pedwarn and it can also be enabled by using -pedantic. If
the pointer is the rightmost operator, there is no warning for Wextra
(surely a bug).

Proposed: Fix the bug. a) Enable the warning with -pedantic or
-Wpointer-arith; or b) Enable the warning with -pedantic or its own
option -Wordered-pointer-comparison (which would be enabled by
Wextra).
There is a patch for option (b):
http://gcc.gnu.org/ml/gcc-patches/2007-01/msg00608.html


* In ./gcc/config/sh/symbian.c:158 there is a warning enabled by Wextra
but conditional on Wattributes.

Proposed: drop the test for Wextra.


* The manual page claims that Wextra warns for any of several
floating-point events that often indicate errors, such as overflow,
underflow, loss of precision, etc. I wasn't able to find any instance
of this. I am fairly sure that Wextra doesn't do such thing.

Proposed: remove text from doc/invoke.texi


* In Java, Wextra warns for unreachable bytecode.

Proposed: a) This should be warned by -Wunreachable-code or b) a new
option -Wunreachable-bytecode that is enabled by Wextra.


* An unsigned value is compared against zero with < or >=.

There is also an unconditional warning for expressions that are always
true or false due to the range of types.

Proposal: my proposal is a new option that takes over both warnings
and is enabled by Wextra. A patch is available at
http://gcc.gnu.org/ml/gcc-patches/2007-01/msg01933.html


That is a lot to do! Well, I hope you find some time to make some suggestions.

Cheers,

Manuel.

Reply via email to