This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: implicit narrowing conversion.
- From: Adam Sulmicki <adam at cfar dot umd dot edu>
- To: "Joseph S. Myers" <jsm at polyomino dot org dot uk>
- Cc: gcc at gcc dot gnu dot org
- Date: Wed, 23 Jun 2004 16:13:10 -0400 (EDT)
- Subject: Re: implicit narrowing conversion.
phew. i wasn't aware of all those requirements.
I'm working right now on another project so I probably won't get right
away to it.
Interestingly enough I already found another error using the said patch on
the code I'm working on.
Is there some example of similar submission which deals with all those
rules? it is easiest to do by example after all...
I agre with you that it is best to separte it out. I'm getting too much
mess from -Wconversion.
finally do you have idea for some better phrasing than:
warning: real type implicitly converted to integer type
it seems like using "real" in place of float or double is somewhat
confuing.
Adam
On Wed, 23 Jun 2004, Joseph S. Myers wrote:
> On Wed, 23 Jun 2004, Adam Sulmicki wrote:
>
> > hmm that stuff is 4 years old. In that case how about the attached patch?
>
> We can't consider patches that don't follow the instructions at
> <http://gcc.gnu.org/contribute.html>, in particular documentation and
> testcases. In this case, there's also the problem of disentangling the
> useless warnings from the present -Wconversion: ones relevant for K&R code
> just converted to C90, but useless for most code being maintained as C90.
> Without those separated out, -Wconversion produces too much junk to be
> useful on real code. But some of the existing -Wconversion warnings are
> useful.
>
> Writing first the documentation, then the testcases, then the
> implementation, is a good discipline for this sort of thing. The
> documentation is easy, as the specification of the new -Wconversion is
> just "warn for any implicit conversion that may change a value" and
> splitting that into separate options (apart from moving the current
> warnings to -Wconversion-traditional) is something that can wait for a
> separate patch. The testcases would probably be several hundred lines
> (covering all types of implicit conversions and all ways they might change
> a value, plus some for -Wconversion-traditional, and making sure that you
> don't e.g. get warnings for converting constant 0 to unsigned int, or
> unsigned short -> int -> unsigned int) - rather bigger than the code
> changes.
>
>