[webkit-dev] Unified sources have broken our #include hygiene

Don.Olmstead at sony.com Don.Olmstead at sony.com
Tue Sep 4 09:31:48 PDT 2018


This was actually something I wanted to bring up at the contributors meeting especially since I was bit by this recently with some CMake changes that busted WPE.

It would be nicer to move our tooling to clang. Include what you use is something I think would be of great use as well. CMake has built in support for a number of static checks https://blog.kitware.com/static-checks-with-cmake-cdash-iwyu-clang-tidy-lwyu-cpplint-and-cppcheck/

My thoughts were to have a `build-webkit –static-analysis` flag that would do non-unified builds as well as potentially adding in dummy .cpp files for headers without an associated .cpp. It would run clang-tidy and include-what-you-use.

From: webkit-dev <webkit-dev-bounces at lists.webkit.org> On Behalf Of Darin Adler
Sent: Saturday, September 1, 2018 7:26 PM
To: Simon Fraser <simon.fraser at apple.com>
Cc: WebKit Development <webkit-dev at lists.webkit.org>
Subject: Re: [webkit-dev] Unified sources have broken our #include hygiene

On Sep 1, 2018, at 5:14 PM, Simon Fraser <simon.fraser at apple.com<mailto:simon.fraser at apple.com>> wrote:

Unified sources allow you to get away without #including all the files you need in a .cpp file, because some earlier file in the group has probably already included them for you.

This means that when you add a new file to the build, and the unified sources get shuffled around, you end up with a long list of build breakages, some platform-specific, that you can only fix by repeating EWS trials.

Yes.

We knew this was going to happen when evaluated the proposal before we switched to unified sources. I believe you can find some discussion of it in webkit-dev.


How can we solve this?

I don’t think we should try to solve it.

To me at the moment, this seems to be a minor irritation. Even without unified sources, it’s common to get includes wrong for platforms other than the one you are testing on and find this out only when building on EWS.

I would be OK having an EWS server that builds various platforms without unified sources, but while it might help it might also hurt, adding more EWS results to interpret for each patch, and also finding theoretical problems that don’t affect any platform.

If there’s a tool that can figure out what files need to be included by analyzing source code, and that works well enough to be practical, I’d love to arrange it so that we can use that instead of having programmers have to write their own include statements. I’ve long been interested in <https://include-what-you-use.org> and wondered whether we could use it, but it sort of does the opposite, and the “multiple platforms” problem could well make even that tool impractical for us.

— Darin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20180904/d07d001d/attachment.html>


More information about the webkit-dev mailing list