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

BSON_EXTRA_ALIGN 0 does not compile with MSVC

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • 1.4.0
    • Affects Version/s: None
    • Component/s: libbson
    • Labels:
      None
    • Fully Compatible

      If BSON_EXTRA_ALIGN is 0 the BSON_ALIGNED_BEGIN macro defined here is invalid.

      MSVC does not allow mathematical expressions in align:

      __declspec( align( # ) ) declarator

      ...

      # is the alignment value. Valid entries are integer powers of two from 1 to 8192 (bytes), such as 2, 4, 8, 16, 32, or 64.

      https://msdn.microsoft.com/en-us/library/83ythb65.aspx

      The cmake file always sets BSON_EXTRA_ALIGN to 1 so this was never noticed.
      https://github.com/mongodb/libbson/blob/33851d13/CMakeLists.txt#L70-L92

            Assignee:
            shane.harvey@mongodb.com Shane Harvey
            Reporter:
            shane.harvey@mongodb.com Shane Harvey
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: