public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Thomas Schwinge <tschwinge@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc/devel/rust/master] Merge #992 Date: Wed, 8 Jun 2022 12:16:12 +0000 (GMT) [thread overview] Message-ID: <20220608121612.B1B0D3816ED0@sourceware.org> (raw) https://gcc.gnu.org/g:865b6090a8f8981cdfc050ea2ee44abbe92de141 commit 865b6090a8f8981cdfc050ea2ee44abbe92de141 Merge: 366c53371ad 7820ff8b8b1 Author: bors[bot] <26634292+bors[bot]@users.noreply.github.com> Date: Mon Mar 7 12:17:40 2022 +0000 Merge #992 992: Cleanup bad unused code warnings r=philberty a=philberty This patchset contains 4 distinct fixes: When a constant is declared after where it is used the code-generation pass falls back to a query compilation of the HIR::Item this did not contain a check to verify if it was already compiled and results in duplicate CONST_DECLS being generated if query compilation was used. We were using a zero precision integer to contain unit-type expressions this results in VAR_DECLS being lost in the GENERIC graph which does not allow us to perform any static analysis upon the DECL. This changes the unit type to use an empty struct and for initialization of a VAR_DECL we can simply pass an empty constructor and let GCC optimize this code for us. Update our DEAD_CODE scan to take into account modules of items and also respect if structures are prefixed with an underscore we can ignore generating an unused warning. Remove our AST scan for unused code and reuse GCC TREE_USED to track wether VAR_DECL, PARM_DECL, CONST_DECL are actually used or not. We reuse the GCC walk_tree functions to have this as nice separate lint. Fixes #676 Co-authored-by: Philip Herron <philip.herron@embecosm.com> Diff: gcc/rust/Make-lang.in | 1 + gcc/rust/backend/rust-compile-context.h | 5 ++ gcc/rust/backend/rust-compile-expr.cc | 9 ++ gcc/rust/backend/rust-compile-item.cc | 4 + gcc/rust/backend/rust-compile-resolve-path.cc | 22 ++++- gcc/rust/backend/rust-compile-stmt.h | 9 +- gcc/rust/backend/rust-compile-tyty.h | 8 +- gcc/rust/lang.opt | 12 +++ gcc/rust/lint/rust-lint-marklive.h | 6 ++ gcc/rust/lint/rust-lint-scan-deadcode.h | 14 +++- gcc/rust/lint/rust-lint-unused-var.cc | 98 ++++++++++++++++++++++ gcc/rust/lint/rust-lint-unused-var.h | 36 ++++++++ gcc/rust/resolve/rust-ast-resolve-unused.h | 61 -------------- gcc/rust/rust-gcc.cc | 22 ++--- gcc/rust/rust-session-manager.cc | 29 +++---- gcc/testsuite/rust/compile/array3.rs | 1 - .../compile/torture/all_doc_comment_line_blocks.rs | 70 ++++++++-------- .../torture/all_doc_comment_line_blocks_crlf.rs | 10 +-- .../rust/compile/torture/associated_types1.rs | 2 - gcc/testsuite/rust/compile/torture/cfg_attr.rs | 1 - gcc/testsuite/rust/compile/torture/generics13.rs | 3 +- gcc/testsuite/rust/compile/torture/generics14.rs | 3 +- gcc/testsuite/rust/compile/torture/generics18.rs | 1 - gcc/testsuite/rust/compile/torture/generics24.rs | 1 - .../rust/compile/torture/impl_block_unused.rs | 10 +-- gcc/testsuite/rust/compile/torture/issue-808.rs | 2 - .../rust/compile/torture/mod-nameresolve.rs | 4 +- gcc/testsuite/rust/compile/torture/mod1.rs | 1 - gcc/testsuite/rust/compile/torture/mod2.rs | 10 +-- gcc/testsuite/rust/compile/torture/must_use2.rs | 1 - .../rust/compile/torture/struct_init_4.rs | 5 +- gcc/testsuite/rust/compile/torture/traits1.rs | 1 - gcc/testsuite/rust/compile/torture/traits10.rs | 1 - gcc/testsuite/rust/compile/torture/traits18.rs | 3 - gcc/testsuite/rust/compile/torture/traits2.rs | 1 - gcc/testsuite/rust/compile/torture/traits3.rs | 3 - gcc/testsuite/rust/compile/torture/traits4.rs | 3 - gcc/testsuite/rust/compile/torture/traits5.rs | 3 - gcc/testsuite/rust/compile/torture/traits6.rs | 2 - gcc/testsuite/rust/compile/torture/traits7.rs | 3 - gcc/testsuite/rust/compile/torture/traits8.rs | 1 - gcc/testsuite/rust/compile/torture/traits9.rs | 3 - .../rust/compile/torture/tuple_enum_variants.rs | 9 +- .../rust/compile/torture/tuple_struct_unused.rs | 4 +- gcc/testsuite/rust/compile/torture/unused1.rs | 1 - .../rust/compile/torture/unused_struct.rs | 1 - gcc/testsuite/rust/compile/traits8.rs | 2 - gcc/testsuite/rust/execute/torture/coercion1.rs | 2 - gcc/testsuite/rust/execute/torture/coercion2.rs | 2 - gcc/testsuite/rust/execute/torture/match2.rs | 1 - gcc/testsuite/rust/execute/torture/mod1.rs | 16 ++-- .../rust/execute/torture/operator_overload_1.rs | 3 - .../rust/execute/torture/operator_overload_10.rs | 4 - .../rust/execute/torture/operator_overload_2.rs | 3 - .../rust/execute/torture/operator_overload_3.rs | 3 - .../rust/execute/torture/operator_overload_4.rs | 2 - .../rust/execute/torture/operator_overload_5.rs | 2 - .../rust/execute/torture/operator_overload_6.rs | 3 - .../rust/execute/torture/operator_overload_7.rs | 2 - .../rust/execute/torture/operator_overload_8.rs | 3 - .../rust/execute/torture/operator_overload_9.rs | 3 - gcc/testsuite/rust/execute/torture/trait10.rs | 2 - gcc/testsuite/rust/execute/torture/trait11.rs | 3 - gcc/testsuite/rust/execute/torture/trait12.rs | 3 - gcc/testsuite/rust/execute/torture/trait13.rs | 2 - gcc/testsuite/rust/execute/torture/trait4.rs | 2 - gcc/testsuite/rust/execute/torture/trait5.rs | 2 - gcc/testsuite/rust/execute/torture/trait6.rs | 2 - gcc/testsuite/rust/execute/torture/trait7.rs | 2 - gcc/testsuite/rust/execute/torture/trait8.rs | 2 - gcc/testsuite/rust/execute/torture/trait9.rs | 3 - 71 files changed, 298 insertions(+), 276 deletions(-)
reply other threads:[~2022-06-08 12:16 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220608121612.B1B0D3816ED0@sourceware.org \ --to=tschwinge@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).