[PING] Walways-true:Warn if a comparison is always true or always false due to the limited range of the data type

Manuel López-Ibáñez lopezibanez@gmail.com
Thu Mar 22 12:56:00 GMT 2007


On 22/03/07, Dirk Mueller <dmueller@suse.de> wrote:
> On Thursday, 22. March 2007, Manuel López-Ibáñez wrote:
>
> > I think that after 18 days, a ping is due.
> > PING: http://gcc.gnu.org/ml/gcc-patches/2007-03/msg00207.html
>
> Again my usual comment: I think -Walways-true is a bad name for a warning that
> warns about expressions being always false.
>
> I think -Wlogical or -Wlogical-invariant or similar would be a better name.
>

I agree that it is a bad name but not because of the reason you point.
I think it is bad because this warning should not try to warn about
anything else than conditions that are always true (or false) because
of the limited
range of the data type. What you are trying to detect is whether you
are using the wrong type in a comparison (or perhaps the wrong
variable). In that context, Walways-true (and Wlogical) are too vague
names but I prefer the former since Wlogical is even vaguer.

Alternative names:

Wtype-range
Wtype-limit
Wtype-bounds
Wrange-limit
Wlimited-range
Wrange
Wlimited
Wlimits
Wtypelimits
Wlimitedtype

Proposals welcome but take into account that more frequently than not
people adding another warning under this option will look at the name
rather than the description, so Wlogical* seems to me one of the worst
choices.

Cheers,

Manuel.



More information about the Gcc-patches mailing list