I am working on embedded systems. I use C to program and ARM compiler to compile.
The code I am working on has been around for sometime an has been developed by multiple people. It uses function pointers as well.
Are there any tools that may help me to detect dead code? If not, how do you suggest I go about it?
The ARM linker supports cross-module optimisation which will remove unused functions within object modules (including class member functions). Dead code within a function will be dealt with by the optimizer.
If you want to actually remove the code from the source, then a static analysis tool will be able to detect similar dead code sections to those that the compiler optimiser can detect.
Have you tried the feedback linker option? It creates a file with a list of unused functions.
See ARM Compiler toolchain Linker Reference > --feedback=file
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With