PR c++/40752 - useless -Wconversion with short +=.
authorJason Merrill <jason@redhat.com>
Tue, 7 Jan 2020 17:20:26 +0000 (12:20 -0500)
committerJason Merrill <jason@redhat.com>
Tue, 21 Jan 2020 23:40:19 +0000 (18:40 -0500)
commitc77074d05691053ee7347d9e44ab89b3adb23fb1
tree589e55a7c74bb1c0ec4c46ac228f20340158909a
parent731dbfc3f3b586e78f2ccdca24561ea3369c6338
PR c++/40752 - useless -Wconversion with short +=.

This is a longstanding issue with lots of duplicates; people are not
interested in a -Wconversion warning about mychar += 1.  So now that warning
depends on -Warith-conversion; otherwise we only warn if operands of the
arithmetic have conversion issues.

* c.opt (-Warith-conversion): New.
* c-warn.c (conversion_warning): Recurse for operands of
operators.  Only warn about the whole expression with
-Warith-conversion.
gcc/c-family/ChangeLog
gcc/c-family/c-warn.c
gcc/c-family/c.opt
gcc/doc/invoke.texi
gcc/testsuite/c-c++-common/Wconversion-pr40752.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/Wconversion-pr40752a.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/Wsign-conversion-1.c [new file with mode: 0644]