Today I played around a bit with libclang and made a graph of include dependencies:
https://dev.visucore.com/bitcoin/includes.svg
Edges show a source file that is included into another. You can hover over connections to highlight them, this can help clarify spaghetti parts.
- it would be nice to get rid of
headers.hand include only what we need in every compilation unit.- Newer files (such as
addrman.cpp,protocol.cpp,version.cpp) are more well-behaved in this regard.
- Newer files (such as
util.h,protocol.hprobably pull in too much.- the hierarchy is too deep; include files shouldn't include that many other include files. For example
headers.h←util.h←uint256.h←serialize.h←allocators.h... - moving code from .h to .cpp files where possible / efficient would help reduce interdependencies