aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2024-09-12 18:22:21 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2024-09-12 18:22:21 +0200
commit4026d89d623e322920b052f7ac0d940ef267dc0f (patch)
tree4a89a6354035611e85eb2e59565beae596c51f86 /gcc/cp
parentce0aecc7df1ff0be24c278dff5575ec28042ee58 (diff)
downloadgcc-4026d89d623e322920b052f7ac0d940ef267dc0f.zip
gcc-4026d89d623e322920b052f7ac0d940ef267dc0f.tar.gz
gcc-4026d89d623e322920b052f7ac0d940ef267dc0f.tar.bz2
c++: Disable deprecated/unavailable diagnostics when creating thunks for methods with such attributes [PR116636]
On the following testcase, we emit false positive warnings/errors about using the deprecated or unavailable methods when creating thunks for them, even when nothing (in the testcase so far) actually used those. The following patch temporarily disables that diagnostics when creating the thunks. 2024-09-12 Jakub Jelinek <jakub@redhat.com> PR c++/116636 * method.cc: Include decl.h. (use_thunk): Temporarily change deprecated_state to UNAVAILABLE_DEPRECATED_SUPPRESS. * g++.dg/warn/deprecated-19.C: New test.
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/method.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/cp/method.cc b/gcc/cp/method.cc
index 68a776d..21c06c7 100644
--- a/gcc/cp/method.cc
+++ b/gcc/cp/method.cc
@@ -26,6 +26,7 @@ along with GCC; see the file COPYING3. If not see
#include "coretypes.h"
#include "target.h"
#include "cp-tree.h"
+#include "decl.h"
#include "stringpool.h"
#include "cgraph.h"
#include "varasm.h"
@@ -283,6 +284,11 @@ use_thunk (tree thunk_fndecl, bool emit_p)
/* Thunks are always addressable; they only appear in vtables. */
TREE_ADDRESSABLE (thunk_fndecl) = 1;
+ /* Don't diagnose deprecated or unavailable functions just because they
+ have thunks emitted for them. */
+ auto du = make_temp_override (deprecated_state,
+ UNAVAILABLE_DEPRECATED_SUPPRESS);
+
/* Figure out what function is being thunked to. It's referenced in
this translation unit. */
TREE_ADDRESSABLE (function) = 1;