We have checks to prevent public headers getting included directly in client code outside of bson.h and mongoc.h:
And a lot of them define this check after the ifdef guard. Example:
So client code can do something like:
And it compiles without issue. This is because mongoc.h includes mongoc-apm.h, which defines MONGOC_APM_H. So when the client code includes mongoc-apm.h directly, no error occurs.
This check should probably be defined outside of the ifdef guard, which only a few files do (e.g. mongoc-rand.h).