Bugzilla – Bug 1832
deheader for ns-3
Last modified: 2016-07-16 17:48:52 EDT
This is a carry-over from work done on bug 1237.
Removing unnecessary header inclusions improves compilation time. Some projects exist to automate this, including:
Daniel Camara spent some time a while back to work on deheader for ns-3. His findings, however, were not yet merged, and need to be updated.
Steps to work on this:
- configure ns-3 without python bindings (the python bindings will change due to this work). './waf configure --disable-python'
- try to reduce the unnecessary includes such as already found by the attached.
- consider to run deheader.py yourself on the codebase
- submit patches to one of the ns-3 maintainers, or attach to this bug report
Created attachment 1757 [details]
deheader.py (modified for use with ns-3-dev)
Created attachment 1758 [details]
deheader report (from bug 1237)
Deheader seems to work only on cpp files.
A similar tool 8requiring clang, tho) is here: http://include-what-you-use.org
According to the docs, it's more aggressive (and optimizing) and it works also on header files. It's worth a check.
About the patch, I think that if someone has enough time to setup a machine running IWYU, he/she can create the patches quite easily.
A followup on this task.
Tonight I (manually) substituting some headers with the respective forward declarations.
C++ didn't complain at all, but PyBindGen did.
Better: it didn't at the moment, but then it generated all sort of errors about wrong forward declarations in the various ns3module.cc.
This happened with gcc 4.8.4, gccxml 0.9 and Python 2.7.6