aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/rust-gcc.cc
diff options
context:
space:
mode:
authorliushuyu <liushuyu011@gmail.com>2022-06-11 20:02:54 -0600
committerliushuyu <liushuyu011@gmail.com>2022-06-28 17:54:18 -0600
commit649d3c45afa9c65cad99c8d195e342b3c8bea43c (patch)
tree6d341c9824ead55b0fa10d5920d66d7cadb3d860 /gcc/rust/rust-gcc.cc
parent04cc46cfe8cad9736ccf2d5c884af50e57b67ce6 (diff)
downloadgcc-649d3c45afa9c65cad99c8d195e342b3c8bea43c.zip
gcc-649d3c45afa9c65cad99c8d195e342b3c8bea43c.tar.gz
gcc-649d3c45afa9c65cad99c8d195e342b3c8bea43c.tar.bz2
rust/backend: scan for any deprecated function calls ...
... and emit warnings using GCC's own deprecation warning system
Diffstat (limited to 'gcc/rust/rust-gcc.cc')
-rw-r--r--gcc/rust/rust-gcc.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/rust/rust-gcc.cc b/gcc/rust/rust-gcc.cc
index 445cb0d..4fea6fb 100644
--- a/gcc/rust/rust-gcc.cc
+++ b/gcc/rust/rust-gcc.cc
@@ -51,6 +51,8 @@
#include "rust-backend.h"
#include "rust-object-export.h"
+#include "backend/rust-tree.h"
+
// TODO: this will have to be significantly modified to work with Rust
// Bvariable is a bit more complicated, because of zero-sized types.
@@ -1852,6 +1854,14 @@ Gcc_backend::call_expression (tree fn, const std::vector<tree> &fn_args,
excess_type != NULL_TREE ? excess_type : rettype,
fn, nargs, args);
+ // check for deprecated function usage
+ if (fndecl && TREE_DEPRECATED (fndecl))
+ {
+ // set up the call-site information for `warn_deprecated_use`
+ input_location = location.gcc_location ();
+ warn_deprecated_use (fndecl, NULL_TREE);
+ }
+
if (chain_expr)
CALL_EXPR_STATIC_CHAIN (ret) = chain_expr;