dead-code

Dead code detection in legacy C/C++ project [closed]

匆匆过客 提交于 2019-11-26 07:07:21
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 3 years ago . How would you go about dead code detection in C/C++ code? I have a pretty large code base to work with and at least 10-15% is dead code. Is there any Unix based tool to identify this areas? Some pieces of code still use a lot of preprocessor, can automated process handle that? 回答1: You could use a code coverage

How can I know which parts in the code are never used?

▼魔方 西西 提交于 2019-11-26 06:51:14
问题 I have legacy C++ code that I\'m supposed to remove unused code from. The problem is that the code base is large. How can I find out which code is never called/never used? 回答1: There are two varieties of unused code: the local one, that is, in some functions some paths or variables are unused (or used but in no meaningful way, like written but never read) the global one: functions that are never called, global objects that are never accessed For the first kind, a good compiler can help:

How can you find unused functions in Python code?

随声附和 提交于 2019-11-26 06:32:23
问题 So you\'ve got some legacy code lying around in a fairly hefty project. How can you find and delete dead functions? I\'ve seen these two references: Find unused code and Tool to find unused functions in php project, but they seem specific to C# and PHP, respectively. Is there a Python tool that\'ll help you find functions that aren\'t referenced anywhere else in the source code (notwithstanding reflection/etc.)? 回答1: In python you can find unused code by using dynamic or static code analyzers

How to disable unused code warnings in Rust?

邮差的信 提交于 2019-11-26 05:22:08
问题 struct SemanticDirection; fn main() {} warning: struct is never used: `SemanticDirection` --> src/main.rs:1:1 | 1 | struct SemanticDirection; | ^^^^^^^^^^^^^^^^^^^^^^^^^ | = note: #[warn(dead_code)] on by default I will turn these warnings back on for anything serious, but I am just tinkering with the language and this is driving me bats. I tried adding #[allow(dead_code)] to my code, but that did not work. 回答1: You can either: Add an allow attribute on a struct, module, function, etc.: #

How to find unused/dead code in java projects

孤街醉人 提交于 2019-11-26 01:40:53
问题 What tools do you use to find unused/dead code in large java projects? Our product has been in development for some years, and it is getting very hard to manually detect code that is no longer in use. We do however try to delete as much unused code as possible. Suggestions for general strategies/techniques (other than specific tools) are also appreciated. Edit: Note that we already use code coverage tools (Clover, IntelliJ), but these are of little help. Dead code still has unit tests, and