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

Maciej Stachowiak mjs at apple.com
Tue Aug 29 11:37:48 PDT 2017

> On Aug 29, 2017, at 11:31 AM, Darin Adler <darin at apple.com> wrote:
> Sent from my iPhone
>> On Aug 29, 2017, at 11:22 AM, Keith Miller <keith_miller at apple.com> wrote:
>> I doubt anyone is going to run such a script before they go to upload a patch to bugzilla. 
> EWS was what I was hoping for; likely to be sufficient. But it could also be integrated into the development process as, say, check-webkit-style is.

check-webkit-style is run by both EWS and webkit-patch upload, in addition to being hand-runnable, so that seems like a good place to put this new kind of check.

>> So developers will still hit the name collision issue randomly throughout development.
> Sure.
> But I don’t think that required extensive use of namespaces is the best way to greatly mitigate this. Mistakes will still happen. So I think we shouldn’t go too far in ruining readability of code for something that is not necessary to solve the problem.
> Recommending either namespaces or globally unique names and clarifying that file local scope doesn’t exist are both good.
> But again I think people already handle these problems fine in headers so we don’t need too tight a straitjacket, at least not out of the gate.

I tend to agree with this. I think keeping names of static functions globally unique is reasonable, so long as we have an automated way to check. This seems better than namespaces. With namespaces, it's still possible to make a mistake, such as by having a using at global scope, so we'd need the style checker to enforce some kind of rule.
If we were to use namespaces, then properly naming them seems better than the FILENAME macro.


More information about the webkit-dev mailing list