On Fri, Jan 22, 2021 at 12:20:55AM +0100, Thomas Monjalon wrote:
> 21/01/2021 16:15, Bruce Richardson:
> > On Thu, Jan 21, 2021 at 10:36:18AM +0100, Thomas Monjalon wrote:
> > > 21/01/2021 10:33, Bruce Richardson:
> > > > On Thu, Jan 21, 2021 at 10:25:07AM +0100, David Marchand wrote:
> > > > > Is rte_byteorder.h inclusion in rte_mbuf.h still necessary?
> > > > >
> > > > Good question. The checks I was doing were only for missing headers.
> > > > Checking for superfluous headers is more complicated and not something 
> > > > I've
> > > > looked at. I know it was previously suggested to use the
> > > > "include-what-you-use" tool on DPDK, if anyone wants to attempt that.
> > > 
> > > I would love having an integration of include-what-you-use in our build 
> > > system.
> > > I don't know whether it's trivial or difficult with meson.
> > > 
> > 
> > Did some initial investigation here, and here are some basic instructions
> > based on how I got it running on my Ubuntu 20.10 system. The positive is
> > that "iwyu_tool" can run on DPDK build dirs without any extra work on our
> > part.
> 
> I had looked at it recently but didn't try thinking meson was not compatible.
> Thank you, it works :)
> 
> > 1. Install iwyu from Ubuntu packaging.
> > 2. Install clang-9 package:
> >     * This is not a dependency of iwyu, but probably should be
> >     * The version of clang installed *must* match that used to build iwyu
> >       [I had clang-10 installed which didn't work for this]
> >     * If you get errors about missing standard headers e.g. stddef.h,
> >       the version mismatch is likely the issue.
> > 3. Configure a clang build of DPDK:
> >     * CC=clang meson <args> build-clang
> > 4. "iwyu_tool" supports the build database format used by meson, so just
> >    run: "iwyu_tool -p build-clang"
> > 
> > Be warned, this runs really slowly and produces lots of output!
> 
> We need to filter only reports of useless includes
> and do the cleaning...
> 
> The difficult part is that some includes may be useless on Linux
> but required on FreeBSD.
>
And that some "useless" includes in headers are required by the
corresponding C file which then needs the include added there. :-(

However, thinking a bit more after sending that email yesterday and looking
at the results, I came to the same conclusion as you - we should use it to
primarily remove unused headers. That will be slowed down by the need for
additional fixup, but it's doable if someone has a bit of time.

/Bruce

Reply via email to