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

Hide unittest private headers with IWYU pragmas

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 Minor - P4
    • 8.1.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Server Programmability
    • Fully Compatible
    • Programmability 2025-02-17
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      In SERVER-99192, a technique was developed to preserve the interface of assert_uti.h.

      Through pragmas, we can prevent IWYU-based tools and IDE extensions from suggesting the inclusion of private detail headers into library user source files. These detail headers are largely redundant to include, and the fact that they are named at all is an abstraction break that makes maintenance refactoring of the library more challenging.

      We don't plan to run IWYU anymore, but the include-cleaner clangd feature is another risk of the same nature.
      https://clangd.llvm.org/guides/include-cleaner
      It is not enabled by default, but some developers have been observed to use it.

      This techinque must be applied to the unittest library as well.

      Without these pragma hints in place, the include-cleaner will suggest private headers inside unittest.h instead of the interface header.

            Assignee:
            billy.donahue@mongodb.com Billy Donahue
            Reporter:
            billy.donahue@mongodb.com Billy Donahue
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved:
              None
              None
              None
              None