[webkit-dev] Unified source builds: A new rule for static variables

Keith Miller keith_miller at apple.com
Mon Aug 28 13:14:30 PDT 2017


Hello WebKittens,

As many of you already know build times in WebKit have a major impact on the productivity of developers. My hope is to change that for clean builds without significantly impacting incremental builds. We’re expecting to see a 3-4x build time speedup on clean builds of WebKit! The current plan is to use unified sources to solve this problem. 

There’s one change you need to be aware of: static variables in .cpp files. When you want to declare a static function or variable (furiable? 🐈) in a .cpp file (I hope you’re not doing that in a header!) you’ll need to put that static in namespace FILENAME { }. For example:

namespace FILENAME {
    static int myVariable { 0 };
    static int myFunction() { return myVariable; }
}

We need to have the namespace because unified source builds compile multiple cpp files as if they were one cpp file so there could be name conflicts. Due to build magic, FILENAME will be the name of the cpp file you are compiling.

If you want to know more about how this works you can check out my other email that goes into more detail.

Cheers,
Keith


More information about the webkit-dev mailing list