Uploaded image for project: 'C Driver'
  1. C Driver
  2. CDRIVER-2839

Refactor header include checks and test in Evergreen

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 Minor - P4
    • 1.14.0, 1.15.0
    • Affects Version/s: None
    • Component/s: libbson, libmongoc
    • None

      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.

            Assignee:
            kevin.albertson@mongodb.com Kevin Albertson
            Reporter:
            kevin.albertson@mongodb.com Kevin Albertson
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: