Bug 1832 - deheader for ns-3
deheader for ns-3
Product: ns-3
Classification: Unclassified
Component: core
PC Linux
: P5 enhancement
Assigned To: ns-bugs
Depends on:
  Show dependency treegraph
Reported: 2014-01-12 17:58 EST by Tom Henderson
Modified: 2016-07-16 17:48 EDT (History)
2 users (show)

See Also:

deheader.py (modified for use with ns-3-dev) (70.50 KB, text/plain)
2014-01-12 17:59 EST, Tom Henderson
deheader report (from bug 1237) (448.47 KB, text/plain)
2014-01-12 18:00 EST, Tom Henderson

Note You need to log in before you can comment on or make changes to this bug.
Description Tom Henderson 2014-01-12 17:58:00 EST
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
Comment 1 Tom Henderson 2014-01-12 17:59:38 EST
Created attachment 1757 [details]
deheader.py (modified for use with ns-3-dev)
Comment 2 Tom Henderson 2014-01-12 18:00:12 EST
Created attachment 1758 [details]
deheader report (from bug 1237)
Comment 3 Tommaso Pecorella 2015-11-15 11:13:20 EST
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.
Comment 4 Tommaso Pecorella 2016-07-16 17:48:52 EDT
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