dead-code

How to find unused/dead code in java projects

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) ar...

Dead code detection in legacy C/C++ project

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? ...

Automated Dead code detection in native C++ application on Windows?

Background I have an application written in native C++ over the course of several years that is around 60 KLOC. There are many many functions and classes that are dead (probably 10-15% like the similar Unix based question below asked). We recently began doing unit testing on all new code and applying it to modified code whenever possibl...

Dead code identification (C++)

I have a large legacy C++ project compiled under Visual Studio 2008. I know there is a reasonably amount of 'dead' code that is not accessed anywhere -- methods that are not called, whole classes that are not used. I'm looking for a tool that will identify this by static analysis. This question: Dead code detection in legacy C/C++ pro...

"Dead code" in Xilinx

I have some VHDL code I'm writing for a class. However, the synthesis tool identifies cell3, cell2, and cell1 as "dead" code and it won't synthesize it. I really have no idea what's going on to cause cell 3,2,1 to be removed in synthesis; I've reviewed it some 5+ times and asked several different people and I can't find the "why". Not...

Tools to detect Dead code in delphi2007 or above

Are there good tools to detect dead code in DELPHI2007 or above? That can integrate with the IDE? The option to look at blue dots is just time consuming, so it’s ruled out. ...

How do you define 'unwanted code'?

How would you define "unwanted code"? Edit: IMHO, Any code member with 0 active calling members (checked recursively) is unwanted code. (functions, methods, properties, variables are members) ...

Is there a way to locate unused event handlers in Delphi?

Finding dead code in Delphi is usually real simple: just compile and then scan for routines missing their blue dots. The smart linker's very good about tracking them down, most of the time. Problem is, this doesn't work for event handlers because they're published methods, which (theoretically) could be invoked via RTTI somehow, even t...

How can you find unused functions in Python code?

So you've got some legacy code lying Python 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 C# and PHP specific, respectively. Is there a Python tool that'll help you find functions that aren't ...

Finding dead PHP5 classes/methods

Is there any tools to check for dead code for PHP5? Something like Scan classes with Reflection Follow "normal" code with token_get_all() and find variables with token T_NEW and then scan for method calls. Output something like classname (count of new declarations) methods (count of calls) ...

static variable initialisation code never gets called

I've got an application that's using a static library I made. One .cpp file in the library has a static variable declaration, whose ctor calls a function on a singleton that does something- e.g. adds a string. Now when I use that library from the application, my singleton doesn't seem to contain any traces of the string that was suppos...

Unreachable code error vs. dead code warning in Java under Eclipse?

Does anyone know why: public void foo() { System.out.println("Hello"); return; System.out.println("World!"); } Would be reported as an "unreachable error" under Eclipse, but public void foo() { System.out.println("Hello"); if(true) return; System.out.println("World!"); } Only triggers a "Dead code" warning? ...

Quick and easy way to remove "dead" (commented out) code

I'm working with an inherited code base which contains thousands of lines of commented out code. I know the previous coder meant to save all his hard work for posterity rather than simply deleting it but: I will never read it and it just gets in the way. One problem example is that when I perform text searches for certain code segments I...

Visual Studio - plugin finding/removing dead code?

Anyone knows any free Visual Studio add-in that would find and/or delete dead (unused) code? I saw such possibility in MZ-Tools, but it's a little expensive as for private use ;) ...

How to keep unreachable code?

I'd like to write a function that would have some optional code to be executed or not depending on user settings. The function is cpu-intensive and having ifs in it would be slow since the branch predictor is not that good. My idea is making a copy in memory of the function and replace NOPs with a jump when I don't want to execute some ...

How to disable dead code elimination in the Java compiler?

This may seem a strange question... Why would anyone want to disable such a thing? But I know what I'm doing (and why I want/need to do this) and I really want to disable dead code elimination. Is it possible somehow? I use Eclipse by the way, if it's relevant... ...

Dead Code error

I'm getting a dead code error in this Java code snippet, using Eclipse: public void rebirthAction() { Player p = new Player(null); Equipment e = new Equipment(); Skills s = new Skills(null); if ((Equipment.SLOT_SHIELD == -1) && (Equipment.SLOT_WEAPON == -1) && (Equipment.SLOT_CHEST == -1) && (Equipment.SLOT_BOTTOMS == -1...

Eclipse's Dead Code warning when it is reachable?

Why Eclipse gives me a dead code warning in the fourth line of the following method? How can it not be reachable? private void writeToSequenceFile() { try { CustomFileWriter nBatchWriter = new CustomFileWriter(sequeneceFileName, CONFIG_RESOURCE_NAME, "outputFile"); // The line below is a dead code? lineBuilder.setString("Li...

Minimize code in reference to read/write operations

Hi, I started with the following code: class Vereinfache2_edit { public static void main(String[] args) { int c1 = Integer.parseInt(args[0]); int c2 = Integer.parseInt(args[1]); int c3 = Integer.parseInt(args[2]); /* 1 */if (c2 - c1 == 0) { /* 2 */if (c1 != c3) { c3 += ...