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

Shim declarations on same line in different TUs can lead to linker errors

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.3.1
    • Component/s: Build
    • Labels:
      None
    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Sprint:
      Dev Tools 2019-11-18

      Description

      The MONGO_DECLARE_SHIM macro uses token pasting to attach the current line number to the internal class it defines: https://github.com/mongodb/mongo/blob/8010c51d3f1cc1020959f8b351f8242d141d42a3/src/mongo/base/shim.h#L136-L139

      If two files declare shims within the same namespace on the same line, that will be an ODR violation:

      The DECLARE_SHIM and related macros must find a way to generate names which cannot collide like this, probably by folding some of the file name into the generated name, or by requiring a stringy argument to the macro to disambiguate.

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: