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

Refactor header include checks and test in Evergreen

    XMLWordPrintable

    Details

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

      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.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: