This is the mail archive of the gcc-patches@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] | |
Some concerns have been raised about -Wconversion warning for signed<->unsigned conversions. Although many users have asked for warnings about those conversions, it is true that they are widespread in real-world code. Thus, it has been requested to remove those warnings from -Wconversion. Yet, I think that there is a group of users that want to be warned about such conversions.
Therefore, the current patch moves signed<->unsigned conversions from -Wconversion to a new option -Wconversion-sign. Warnings for a negative value assigned to a unsigned variable are kept in -Wconversion, since those were in Wconversion already and we haven't received any complaints about it up to now (on the contrary, there were some requests to implement them in C++).
* doc/invoke.texi (Warning Options): Add -Wconversion-sign. (Wconversion): Update description. (Wconversion-sign): New. * c.opt (Wconversion-sign): New. * c-common.c (conversion_warning): Warn with either Wconversion or Wconversion-sign. (warnings_for_convert_and_check): Likewise.
testsuite/ * gcc.dg/Wconversion-integer.c: Move some warnings to Wconversion-sign.c * gcc.dg/Wconversion-sign.c: New. * g++.dg/warn/Wconversion-integer.C: Move some warnings to Wconversion-sign.C * g++.dg/warn/Wconversion-sign.C: New.
Attachment:
wconversion-sign-try2.diff
Description: Text document
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |