[CDRIVER-2839] Refactor header include checks and test in Evergreen Created: 01/Oct/18  Updated: 28/Oct/23  Resolved: 15/Mar/19

Status: Closed
Project: C Driver
Component/s: libbson, libmongoc
Affects Version/s: None
Fix Version/s: 1.14.0, 1.15.0

Type: Task Priority: Minor - P4
Reporter: Kevin Albertson Assignee: Kevin Albertson
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to CDRIVER-2993 Add missing header include checks Closed

 Description   

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.



 Comments   
Comment by Githook User [ 15/Mar/19 ]

Author:

{'name': 'Kevin Albertson', 'username': 'kevinAlbs', 'email': 'kevin.albertson@mongodb.com'}

Message: CDRIVER-2839 test prelude includes
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/0d841186815e5d805aca292b9a0b2fda4027941a

Comment by Kevin Albertson [ 07/Mar/19 ]

Closed too soon. I did not add tests.

Comment by Githook User [ 11/Oct/18 ]

Author:

{'name': 'Kevin Albertson', 'email': 'kevin.albertson@10gen.com', 'username': 'kevinAlbs'}

Message: CDRIVER-2839 refactor header include checks
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/7e2e9caebacd708e42a0b2563f5c4089ffdf5d26

Generated at Wed Feb 07 21:16:30 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.