4
How to detect unused includes in C source code?
(alien.top)
A community for the timeless and infinitely powerful editor. Want to see what Emacs is capable of?!
Never heard of such thing. I don't think that could be done correctly either. How do you detect is an include is used? Looking if it defines something? what about a conditional that can exclude the whole file unless a define is set?
usually the compiler can help here, as it knows what was needed in the code and where the definition came from, including macros. Not sure there is an open-source tol for that though, if clang-tidy does not do it.
as it was said elsewhere, when there are several configurations at play, one needs to be careful.