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]
Other format: [Raw text]

Re: implicit narrowing conversion.


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.

-- 
Joseph S. Myers               http://www.srcf.ucam.org/~jsm28/gcc/
    jsm@polyomino.org.uk (personal mail)
    jsm28@gcc.gnu.org (Bugzilla assignments and CCs)


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