[systemd-devel] Removing unnecessary includes

Thomas H.P. Andersen phomes at gmail.com
Sat Feb 7 01:29:39 PST 2015


Hi,

I am looking at ways to automatically trim the unnecessary includes.
One way to do it is a script[1] which simply tests if the compile
still works after removing each include one at a time. It does this in
reverse order for all includes in the .c files. Using -Werror we catch
any new warnings too.

It takes a while to run and the results are for whatever reason broken
for some files. This sort of thing requires manual review of each
removal of course but it seems useful to find potential targets for
removal. This will be a lot less automatic than I like but I am fine
with going trough everything. What do you think? Worth it?

I have attached a diff from a partial run that show what the script
found for src/a* to src/I* minus a few cases where it failed.

[1] http://www.catb.org/~esr/deheader/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: partial_include_removal
Type: application/octet-stream
Size: 17200 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20150207/609a341a/attachment-0001.obj>


More information about the systemd-devel mailing list