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

issue pinheadmz openend 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:

    0/Users/matthewzipkin/Desktop/work/bitcoin/src/ipc/libmultiprocess/src/mp/util.cpp:84:25: error: use nullptr [modernize-use-nullptr,-warnings-as-errors]
    1   84 |     pthread_threadid_np(NULL, &tid);
    2      |                         ^~~~
    3      |                         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:

    0--> which clang-tidy
    1/opt/homebrew/Cellar/llvm/22.1.1/bin/clang-tidy
    2--> clang-tidy --version
    3Homebrew LLVM version 22.1.1
    4  Optimized build.
    

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

     0bctidy(){
     1  cd /Users/matthewzipkin/Desktop/work/bitcoin
     2  cmake -B build_tidy -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
     3  cmake --build build_tidy -j 8
     4
     5  set -eo pipefail
     6  (
     7    cd ./src/ &&
     8    if ! ( PYTHONUNBUFFERED=1  run-clang-tidy -p ../build_tidy -quiet -config-file=.clang-tidy -j 8 | tee  ../build_tidy/tidy-out.txt ); then
     9      echo
    10      echo "Failure generated from clang-tidy:"
    11      grep -C5 "error: " ../build_tidy/tidy-out.txt
    12    fi
    13  )
    14}
    
  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.


pinheadmz Sjors


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-03-29 21:30 UTC

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