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

BSON_EXTRA_ALIGN 0 does not compile with MSVC

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor - P4
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.4.0
    • Component/s: libbson
    • Labels:
      None
    • Backwards Compatibility:
      Fully Compatible

      Description

      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

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved: