- The goal of this project is to develop an option warning of any implicit conversion that may change a value. Examples of such conversions are passing a double value to a function declared to receive a float argument and setting a signed constant to an unsigned variable. The option should not warn of explicit conversions or of cases where the value cannot in fact change despite the implicit conversion. Our proposal is two warning options. One of them would encapsulate the behaviour required by protoize to detect where the addition of prototypes may led to new bugs. The other warning option will identify coercions that may change a value. Tentatively, we will call the former Wtraditional-conversion and the latter Wcoercion just for the sake of clarity and to distinguish both of them from the original Wconversion. In the final implementation the name Wconversion will be used instead of Wcoercion.
Personnel
- Manuel López-Ibáñez
- Ian Lance Taylor (mentor)
Delivery Date
- Most of the work is done. Patches are in the queue pending review.
Benefits
- Current Wconversion is confusing: it encapsulates two different behaviours. As a result, Wconversion is used for the wrong purpose.
- Wcoercion implements a frequently requested feature.
- The behaviours of C and C++ front ends would be more consistent.
Closes bug 9072, bug 2707, bug 26167, bug 26298, and probably more.
Better fix for bug 13932.
Dependencies
- None.
Modifications Required
- C and C++ front-ends.
Reviewers
- Joseph Myers :
- gcc/builtins.c gcc/c.opt gcc/c-typeck.c gcc/c-common.* gcc/doc/invoke.texi gcc/doc/invoke.texi
- Jason Merrill :
- gcc/cp/call.c
- Ben Elliston :
- gcc/dfp.*
- Ian Lance Taylor :
- gcc/real.*