[backport#10574] Remove includes in .cpp files for things the corresponding .h file already included
Summary:
Remove includes in .cpp files for things the corresponding .h file
already included.
Example case:
addrdb.cpp includes addrdb.h and fs.h
addrdb.h includes fs.h
Then remove the direct inclusion of fs.h in addrman.cpp and rely on the
indirect inclusion of fs.h via the included addrdb.h.
In line with the header include guideline (see #10575).
Candidates for removal found by:
#!/bin/bash for H in $(git grep "" -- "*.h" | cut -f1 -d: | uniq); do CPP=${H/%\.h/.cpp} if [[ ! -e $CPP ]]; then continue fi cat "$H" "$CPP" | grep -E "^#include " | sort | uniq -c | \ grep " 2 #include" && echo "$CPP" && echo done
Backport of Core PR10574
Test Plan:
ninja check-all
Reviewers: #bitcoin_abc, deadalnix
Reviewed By: #bitcoin_abc, deadalnix
Differential Revision: https://reviews.bitcoinabc.org/D6666