clang-tidy error (on not-linux): use nullptr instead of NULL #261

issue pinheadmz opened this issue on March 19, 2026
  1. pinheadmz commented at 9:02 PM on March 19, 2026: none

    Running clang-tidy on macos I get this error:

    /Users/matthewzipkin/Desktop/work/bitcoin/src/ipc/libmultiprocess/src/mp/util.cpp:84:25: error: use nullptr [modernize-use-nullptr,-warnings-as-errors]
       84 |     pthread_threadid_np(NULL, &tid);
          |                         ^~~~
          |                         nullptr
    
    

    I suspect the reason this hasn't triggered failures on our CI is that this code block is not compiled on linux:

    https://github.com/bitcoin-core/libmultiprocess/blob/22bec918c97d32660c4694c3a8b5af4cdbb88481/src/mp/util.cpp#L80-L90

  2. Sjors commented at 1:04 PM on March 20, 2026: member

    One does not simply ... run clang-tidy on macOS. Anything special needed to reproduce this?

  3. pinheadmz commented at 1:26 PM on March 20, 2026: none

    Simple!

    brew install llvm:

    --> which clang-tidy
    /opt/homebrew/Cellar/llvm/22.1.1/bin/clang-tidy
    --> clang-tidy --version
    Homebrew LLVM version 22.1.1
      Optimized build.
    

    Modified some code from bitcoin core ci/test/03_test_script.sh and added to .bash_profile:

    bctidy(){
      cd /Users/matthewzipkin/Desktop/work/bitcoin
      cmake -B build_tidy -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
      cmake --build build_tidy -j 8
    
      set -eo pipefail
      (
        cd ./src/ &&
        if ! ( PYTHONUNBUFFERED=1  run-clang-tidy -p ../build_tidy -quiet -config-file=.clang-tidy -j 8 | tee  ../build_tidy/tidy-out.txt ); then
          echo
          echo "Failure generated from clang-tidy:"
          grep -C5 "error: " ../build_tidy/tidy-out.txt
        fi
      )
    }
    
    
  4. Sjors commented at 2:30 PM on March 20, 2026: member

    Thanks, managed to reproduce. I also made a utility out of your script: https://github.com/Sjors/dev-utils/tree/master?tab=readme-ov-file#tidy-btc-maczsh

  5. Sjors commented at 2:54 PM on March 20, 2026: member

    Fixed in #262.


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin-core/libmultiprocess. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-20 17:30 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me