[systemd-devel] Removing unnecessary includes
Lennart Poettering
lennart at poettering.net
Thu Feb 12 02:05:15 PST 2015
On Wed, 11.02.15 23:46, Thomas H.P. Andersen (phomes at gmail.com) wrote:
> On Wed, Feb 11, 2015 at 12:39 PM, Lennart Poettering
> <lennart at poettering.net> wrote:
> > On Wed, 11.02.15 01:40, Thomas H.P. Andersen (phomes at gmail.com) wrote:
> >
> >> Yep. Makes sense.
> >>
> >> Here is a status on what I have done so far.
> >>
> >> include-what-you-want does the following:
> >> 1) sorts the includes
> >> 2) adds missing headers for any symbols used
> >> 3) adds forward declarations
> >> 4) removes any unused headers (after step 2+3)
> >> 5) changes some headers. (only saw <sys/poll.h> to <poll.h> for now)
> >>
> >> The diff we get out of that is too big a mess to locate what we want:
> >> the currently unused headers. To break it up I first did the sorting
> >> in separate step. (I have a patch to commit after 219 for some minor
> >> issues that came up from that). I then started to look at all the
> >> removals and one by one see if they make sense today, or was due to
> >> step 2/3/5, or was something we want to keep like missing.h. It is
> >> slow manual work but I will get there.
> >>
> >> It would be helpful to know if we might want 2, 3, and 5 done?
> >
> > What precisely do you mean by 3?
>
> E.g. for src/journal/mmap-cache.h it replaces
> #include <sys/stat.h>
> by
> struct stat;
>
> since we only use the struct but none of the functions. Saves time
> including that header and anything it brings in with it.
Oh, no, that sounds like an awful idea... We want readable, minimal
sources, but certainly don't want to fine-tune compilation times with
concepts like this...
Lennart
--
Lennart Poettering, Red Hat
More information about the systemd-devel
mailing list