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

add MONGO_CONCEPTS_ macro prefix

    • Type: Icon: Improvement Improvement
    • Resolution: Won't Fix
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Internal Code
    • Labels:
    • Service Arch

      The src/mongo/util/concepts.h header defines a set of 4 macros:

      #define TEMPLATE(...)
      #define REQUIRES(...)
      #define REQUIRES_OUT_OF_LINE_DEF(...)
      #define REQUIRES_FOR_NON_TEMPLATE(...)

      Change these to

      #define MONGO_CONCEPTS_TEMPLATE(...)
      #define MONGO_CONCEPTS_REQUIRES(...)

      An examination of the sites that use these names shows they can afford the extra space.

      TEMPLATE and REQUIRES are single common words that are overloaded to mean various unrelated things. Google uses REQUIRES annotations to enforce lock ordering, and even has its own #define REQUIRES in the vendored benchmark library, which I'm in the process of upgrading. It would be clearer and safer if Mongo's Concepts macros were renamed with a MONGO_CONCEPTS_* prefix.

      I thought of this when I saw that the Catch framework uses a REQUIRE macro, which is almost but not quite a collision with our REQUIRES macro. It's a close call. In Catch (which has been tossed around as a possibility for us SERVER-37517), you can #define CATCH_CONFIG_PREFIX_ALL to avoid such conflicts, so their REQUIRE becomes CATCH_REQUIRE instead.

            backlog-server-servicearch [DO NOT USE] Backlog - Service Architecture
            billy.donahue@mongodb.com Billy Donahue
            0 Vote for this issue
            3 Start watching this issue