C++ whole program analysis for unused functions?

  • SonarQube Developer Edition, 8.9 (build 43852), SonarScanner 4.6.1

  • I am trying to find unused functions in a project with several libraries where all the libraries and the application are compiled together. (To clarify, I want to find unused functions when the application and its dependencies are taken together as a whole, so the resultant action would be to remove anything unused from both the application and libraries.)

  • I just installed SonarQube for the first time, configured it and ran an analysis.

I get 0 for the “Unused function and methods …” rule, which surprises me in general and I’m 99% sure it’s not true for the project taken as a whole.

Am I asking too much? :slight_smile: I have read several times about SonarQube operating on a per-TU basis, so I realize this feature might not exist. But if I just need to link my libraries and application differently (maybe statically instead of dynamically), then that’s an option.

Thanks, cheers.

Jeremy

Hi @jeremy_murphy ,

project-level unused function rule is not enabled by default, did you enable it in your project quality profile? This is the rule: S5536

Thanks, @mpaladin !

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.