Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-8897

Avoid using non-portable ##__VA_ARGS comma elision construct in mongo initializers facility

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.5.0
    • Component/s: Internal Code
    • Labels:
    • Backwards Compatibility:
      Fully Compatible

      Description

      We currently make use of the GCC extension that gives special behavior to the token pasted ##_VA_ARGS_ expression, such that the comma before the ## is elided:

      http://gcc.gnu.org/onlinedocs/cpp/Variadic-Macros.html

      While this extension is widely honored by other compilers, C99 actually introduced a specification for variadic macros, and that specification does not honor this construction.

      As a result, when we compile with -std=c++11 we get the C99 version of variadic macros rather than the GNU version, so the commas are no longer elided as our macros expcet and the mongo initializer stuff breaks.

      In the interest of avoiding non-portable compiler extensions, even if widely implemented in other compilers, we should avoid using the token-pasting trick and find another way to make the mongo initializer macros work.

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            acm Andrew Morrow
            Participants:
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: