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]

[4.3] wcoercion project (1)


Joseph agreed to review this patch, however, I would welcome anyone comments.

IMPORTANT: the patch doesn't perform the renames mentioned in the
Changelog, this way 1) it is easier to see the changes and 2) it is
better to do this operation using "svn move". Please, after applying
the patch and before commiting, remember to perform the renames
described in the Changelog.


This is the first of the patches resulting from the Wcoercion Project http://gcc.gnu.org/wiki/Wcoercion#Background

This patch splits the functionality of Wconversion into two separated options:

a) Wconversion[*]:  warn if a negative integer constant expression is
implicitly converted to an unsigned type.  For example, warn about the
assignment
unsigned x = -1 if x is unsigned. But do not warn about
explicit casts like (unsigned) -1.

b) Wtraditional-conversion:  Warn of prototypes causing type
conversions different from what would happen in the absence of
prototype.

This patch also fixes PR 9072.

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

:ADDPATCH c/c++:

[*] The original proposal was to name this option as Wcoercion to
avoid confusion with the old functionality of Wconversion. That is why
the project is named Wcoercion.


Manuel Lopez-Ibanez <lopezibanez@gmail.com>


	PR c/9072
	* c.opt: New option Wtraditional-conversion. Update description of Wconversion.
       * c-typeck.c: Warnings for prototypes causing type conversions
different from what would happen in the absence of prototype are now
handled by Wtraditional-conversion.
       * doc/invoke.texi: Document the changes.
       * testsuite/gcc.dg/builtin-protos-1.c: Update testsuite.
       * testsuite/gcc.dg/overflow-warn-2.c: Likewise.
       * testsuite/gcc.dg/Wconversion.c: Renamed as Wtraditional-conversion.c
       * testsuite/gcc.dg/dfp/Wconversion-2.c: Renamed as
Wtraditional-conversion-2.c
       * testsuite/gcc.dg/Wconversion-negative-constants.c: New test.

Attachment: wcoercion-1of3-split.patch
Description: Binary data


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