Manuel LÃpez-IbÃÃez - [PING^2] [4.3] Wconversion: fixes for C++ front-end (original) (raw)

This is the mail archive of the gcc-patches@gcc.gnu.orgmailing 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]

(Although Jason Merrill accepted to review this, it seems he is very busy at the moment. I think he won't mind if any other C++ front-end reviewer steps up and takes a look at it, please. Actually, this patch documents Wconversion warnings added to C++ by other developers, so they may be interested on their intent being described correctly. Also, it provides an alternative fix for PR c++/13932, better in my opinion but the original author may disagree).

I have re-rebuilt the patch [1][2] for a recent revision 119662 and updated the testcases to handle targets where sizeof (long double) == sizeof (double) and char is unsigned, following the updates already applied to the C testsuite [3].

[1] http://gcc.gnu.org/ml/gcc-patches/2006-11/msg01227.html [2] http://gcc.gnu.org/ml/gcc-patches/2006-11/msg01684.html [3] http://gcc.gnu.org/ml/gcc-cvs/2006-12/msg00281.html

Bootstrapped and regression tested:

2006-12-10 Manuel Lopez-Ibanez manu@gcc.gnu.org * doc/invoke.texi (-Wconversion): Document warnings specific to C++.

cp/ 2006-12-10 Manuel Lopez-Ibanez manu@gcc.gnu.org

testsuite/ 2006-12-10 Manuel Lopez-Ibanez manu@gcc.gnu.org

On 25/11/06, Manuel LÃpez-IbÃÃez lopezibanez@gmail.com wrote:

I have rebuilt the patch (just offset changes) for a recent revision (119143). It should apply cleanly against mainline and it doesn't depend on any other uncommitted patch.

Also, bootstrapped and tested with --enable-languages=all for trunk revision 119143 on i686-pc-linux-gnu

2006-11-17 Manuel Lopez-Ibanez manu@gcc.gnu.org

* cp/call.c (convert_like_real): Use convert_and_check() instead

of custom warning. * cp/typeck.c (build_binary_op): Use convert_and_check() before conversion. * doc/invoke.texi (-Wconversion): Document warnings specific to C++.

testsuite/ 2006-11-17 Manuel Lopez-Ibanez manu@gcc.gnu.org

* g++.dg/warn/Wconversion-integer.C: New
* g++.dg/warn/Wconversion-real.C: New.
* g++.dg/warn/Wconversion-real-integer.C: New.
* g++.dg/warn/conv2.C: Modified.

On 17/11/06, Manuel LÃpez-IbÃÃez lopezibanez@gmail.com wrote:

Ooops! GTK file dialog cut my filename! That is what I deserve for using Firefox in KDE. Second try.

On 17/11/06, Manuel LÃpez-IbÃÃez lopezibanez@gmail.com wrote:

:ADDPATCH C++:

( 4th patch in the series from the Wcoercion Project http://gcc.gnu.org/wiki/Wcoercion#Background )

This patch addresses some issues with the implementation of Wconversion in the C++ front-end:

  • Adds testcases for the C++ front-end. The testcases are exactly equal to those in the C front-end.

  • warns for int i = 1.1 but not for int i = 1.0 (I think this is a better fix for PR13932).

  • updates the manual to document all warnings given for C++. (I am not an expert in C++ so suggestions are certainly welcome).

Jason Merrill agreed to review this patch but any comments are welcome. In particular, I am not sure what side-effects may have the use of convert_and_check() in C++ (which uses convert internally) since sometimes the C++ front-end uses cp_convert() and other functions instead of convert().

Bootstrapped and tested with --enable-languages=all for trunk revision 118055 on i686-pc-linux-gnu

2006-11-17 Manuel Lopez-Ibanez manu@gcc.gnu.org

  * cp/call.c (convert_like_real): Use convert_and_check() instead

of custom warning. * cp/typeck.c (build_binary_op): Use convert_and_check() before conversion. * doc/invoke.texi (-Wconversion): Document warnings specific to C++.

testsuite/ 2006-11-17 Manuel Lopez-Ibanez manu@gcc.gnu.org

  * g++.dg/warn/Wconversion-integer.C: New
  * g++.dg/warn/Wconversion-real.C: New.
  * g++.dg/warn/Wconversion-real-integer.C: New.
  * g++.dg/warn/conv2.C: Modified.

Attachment:wcoercion-4-gplusplus-try5-powerpc.diff
Description: Text document


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