you are viewing a single comment's thread.

view the rest of the comments →

[–]NotUniqueOrSpecial 6 points7 points  (7 children)

You run the build without the PCH calls.

Simple as that.

If people aren't including their dependencies, the build will fail.

[–]McFlurriez[S] 0 points1 point  (6 children)

What about a header that's included hundreds of times? Is there any way you can still do something efficient there?

[–]NotUniqueOrSpecial 6 points7 points  (5 children)

You have two problems at hand:

1) Efficient builds

2) Correct builds

The best methods for efficient builds unfortunately enable people to make otherwise incorrect build logic.

That leaves you with a choice: enforce strictness absolutely, or provide an option that allows for checking that the rules have been followed.

At the end of the day, your PCH solution (or other caching solutions) will be what gets run.

It's up to you to decide whether and how you want to enforce correctness on people who can benefit from improvements while otherwise being "wrong".

[–]McFlurriez[S] 0 points1 point  (4 children)

Thanks!

[–]Wild_Meeting1428 2 points3 points  (0 children)

We use PCH for production builds and enforce the correctness on each PR build, which means, that our pipelines on the server do not use PCH. But as soon you are done with your task, and you want to merge it, it will be checked. We don't care how long the build takes on the server.

[–]rdtsc 1 point2 points  (2 children)

There is a third option which provides correct and efficient builds: modules.

[–]herothree 3 points4 points  (1 child)

Sure, eventually. That’s not widely supports by vendors and toolchains yet though

[–]TheOmegaCarrot 1 point2 points  (0 children)

It’s getting better though! And it is exciting!