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

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.3.1
    • Affects Version/s: None
    • Component/s: Build
    • Labels:
      None
    • Fully Compatible
    • ALL
    • Dev Tools 2019-11-18

      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.

            Assignee:
            billy.donahue@mongodb.com Billy Donahue
            Reporter:
            andrew.morrow@mongodb.com Andrew Morrow (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: