c++: Add -Wexceptions warning option [PR97675]
authorMarek Polacek <polacek@redhat.com>
Tue, 3 Nov 2020 22:46:23 +0000 (17:46 -0500)
committerMarek Polacek <polacek@redhat.com>
Thu, 5 Nov 2020 20:57:22 +0000 (15:57 -0500)
commit1d87302a8e20c1f49dd37177ec869ee94abc11a5
treef4ba979a14c37961427d82e77686667be8cb8be1
parent5b2003105b35f8fe8e074c055a718c8f484d9d32
c++: Add -Wexceptions warning option [PR97675]

This PR asks that we add a warning option for an existing (very old)
warning, so that it can be disabled selectively.  clang++ uses
-Wexceptions for this, so I added this new option rather than using
e.g. -Wnoexcept.

gcc/c-family/ChangeLog:

PR c++/97675
* c.opt (Wexceptions): New option.

gcc/cp/ChangeLog:

PR c++/97675
* except.c (check_handlers_1): Use OPT_Wexceptions for the
warning.  Use inform for the second part of the warning.

gcc/ChangeLog:

PR c++/97675
* doc/invoke.texi: Document -Wexceptions.

gcc/testsuite/ChangeLog:

PR c++/97675
* g++.old-deja/g++.eh/catch10.C: Adjust dg-warning.
* g++.dg/warn/Wexceptions1.C: New test.
* g++.dg/warn/Wexceptions2.C: New test.
gcc/c-family/c.opt
gcc/cp/except.c
gcc/doc/invoke.texi
gcc/testsuite/g++.dg/warn/Wexceptions1.C [new file with mode: 0644]
gcc/testsuite/g++.dg/warn/Wexceptions2.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.eh/catch10.C