GCC will warn on unused functions, labels, etc. But it seems it doesn't warn on unused definitions? Is there a way to detect unused struct definitions automatically?
You won't necessarily be able to identify individual structs but there is a tool called include-what-you-use
which allows you to eliminate unused includes. See here:
https://include-what-you-use.org/
and here for using with CMake: How to use the tool include-what-you-use together with CMake to detect unused headers?
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