The header checks described in CDRIVER-2797 are repeated throughout the codebase.
We should consider refactoring them into three files
mongoc-header-check.h, consisting of:
#if !defined(MONGOC_INSIDE) && !defined(MONGOC_COMPILATION) #error "Only <mongoc.h> can be included directly." #endif
bson-header-check.h, consisting of:
#if !defined(BSON_INSIDE) && !defined(BSON_COMPILATION) #error "Only <bson/bson.h> can be included directly." #endif
And common-header-check.h, consisting of:
#if !defined(MONGOC_INSIDE) && !defined(MONGOC_COMPILATION) && \ !defined(BSON_INSIDE) !defined(BSON_COMPILATION) #error "Only <mongoc/mongoc.h> or <bson/bson.h> can be included directly." #endif
We can verify with an Evergreen task that each header (except bson.h and mongoc.h) includes one of these checks directly after the license. We could also use the same check to verify that each file has a license.
- related to
-
CDRIVER-2993 Add missing header include checks
- Closed