PR c++/87029, Implement -Wredundant-move.
authorMarek Polacek <polacek@redhat.com>
Sun, 26 Aug 2018 16:45:51 +0000 (16:45 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Sun, 26 Aug 2018 16:45:51 +0000 (16:45 +0000)
commitb5be6d0c166ff1fd3cf90eb846fa24453ee0fc10
tree3eee6900b2acb67b5d22f1a855250865510a30f7
parent0940fe595548ec397ffdb6c2f8fa4392c1c15ec5
PR c++/87029, Implement -Wredundant-move.

* c.opt (Wredundant-move): New option.

* typeck.c (treat_lvalue_as_rvalue_p): New function.
(maybe_warn_pessimizing_move): Call convert_from_reference.
Warn about redundant moves.

* doc/invoke.texi: Document -Wredundant-move.

* g++.dg/cpp0x/Wredundant-move1.C: New test.
* g++.dg/cpp0x/Wredundant-move2.C: New test.
* g++.dg/cpp0x/Wredundant-move3.C: New test.
* g++.dg/cpp0x/Wredundant-move4.C: New test.

From-SVN: r263863
gcc/ChangeLog
gcc/c-family/ChangeLog
gcc/c-family/c.opt
gcc/cp/ChangeLog
gcc/cp/typeck.c
gcc/doc/invoke.texi
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/Wredundant-move1.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp0x/Wredundant-move2.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp0x/Wredundant-move3.C [new file with mode: 0644]
gcc/testsuite/g++.dg/cpp0x/Wredundant-move4.C [new file with mode: 0644]