[systemd-devel] Removing unnecessary includes

Lennart Poettering lennart at poettering.net
Tue Feb 10 13:05:34 PST 2015


On Sat, 07.02.15 10:29, Thomas H.P. Andersen (phomes at gmail.com) wrote:

> 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.

I think this is quite useful, but I'd also be really careful with
this. glibc versions sometimes require different headers to be
included to get some functionality, thus automatic removal of headers
that are unnecessary on one system doesn't mean this is universally
the case... Moreover depdending on compile-time options you might
different headers...

Lennart

-- 
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list