Uploaded image for project: 'WiredTiger'
  1. WiredTiger
  2. WT-10619

Update Clang-Format to 12.0.1

    • 5
    • 2023-02-23 "Stoney Baloney", 2023-06-27 Lord of the Sprints, 2023-07-11 WiredTractor, StorEng - 2023-08-08

      MongoDB has just aligned its code with Clang-Format 12.0.1, let's do the same.

      To do so we'll make the following 12.0.1 clang-format binaries available for download in the download_clang_format of s_clang_format:

      • x86 Linux
      • ARM Linux
      • x86 macOS
      • ARM macOS

      Details for how to do this can be found in the comments of s_clang_format, and a recent example is present in WT-11092. I didn't notice any macOS/darwin binaries on the release page however, so we may need to build these ourselves. To do so we can use the following steps:

      # Building clang-format for s_all
      # Similar instructions can be found at https://clang.llvm.org/get_started.html
      
      # llvm is a *big* repo. Only copy the 10.0.0 tag with no git history
      git clone --branch llvmorg-10.0.0 --depth 1 https://github.com/llvm/llvm-project.git
      
      # Both cmake and ninja produce warnings here. They don't seem to impact the final binary
      mkdir build
      cd build
      cmake -DLLVM_ENABLE_PROJECTS=clang -DCMAKE_BUILD_TYPE=Release -G Ninja ../llvm
      ninja clang-format
      
      cp bin/clang-format /your/path/to/wiredtiger/dist 

      These steps should be added to a comment in s_clang_format for future reference, and can also improve the error reporting of this script at the same time. Currently it's unclear why the script fails when it can't find the correct binaries, just reporting "./s_clang_format: unsupported architecture and OS combination 'arm64-Darwin' to run clang_format"

       

       

      Finally, 12.0.1 formats a small number of files differently to 10.0.0. We should spend a small (half a day) amount of effort to determine whether new settings need to be added to .clang-format to retain our current formatting for all files.

            Assignee:
            clarisse.cheah@mongodb.com Clarisse Cheah
            Reporter:
            etienne.petrel@mongodb.com Etienne Petrel
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: