build: add -Wthread-safety-pointer #32647

pull fanquake wants to merge 3 commits into bitcoin:master from fanquake:thread_safety_pointer changing 2 files +3 −2
  1. fanquake commented at 4:03 pm on May 30, 2025: member

    This will become available in Clang 21:

    ThreadSafetyAnalysis now supports -Wthread-safety-pointer, which enables warning on passing or returning pointers to guarded variables as function arguments or return value respectively. Note that ThreadSafetyAnalysis still does not perform alias analysis. The feature will be default-enabled with -Wthread-safety in a future release.

    See https://github.com/llvm/llvm-project/blob/main/clang/docs/ReleaseNotes.rst.

    Also updates the leveldb subtree to pull: https://github.com/bitcoin-core/leveldb-subtree/pull/54.

  2. Squashed 'src/leveldb/' changes from 113db4962b..aba469ad6a
    aba469ad6a Merge bitcoin-core/leveldb-subtree#54: Fix clang thread-safety-pointer warnings
    7daf4ed575 Fix clang thread-safety-pointer warnings
    
    git-subtree-dir: src/leveldb
    git-subtree-split: aba469ad6a808da8381edf83a99e5ece18958b31
    240a4fb95d
  3. Update leveldb subtree to latest upstream e639ae0531
  4. build: add -Wthread-safety-pointer
    This will become available in Clang 21:
    
    > ThreadSafetyAnalysis now supports -Wthread-safety-pointer, which
    > enables warning on passing or returning pointers to guarded variables
    > as function arguments or return value respectively. Note that
    > ThreadSafetyAnalysis still does not perform alias analysis. The
    > feature will be default-enabled with -Wthread-safety in a future release.
    
    See
    https://github.com/llvm/llvm-project/blob/main/clang/docs/ReleaseNotes.rst.
    83bfe1485c
  5. DrahtBot commented at 4:03 pm on May 30, 2025: contributor

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/32647.

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK davidgumberg, theuni, maflcko

    If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.

  6. DrahtBot added the label Build system on May 30, 2025
  7. fanquake marked this as ready for review on Jun 1, 2025
  8. fanquake requested review from davidgumberg on Jun 2, 2025
  9. fanquake requested review from theuni on Jun 2, 2025
  10. davidgumberg commented at 8:22 am on June 3, 2025: contributor

    Tested ACK https://github.com/bitcoin/bitcoin/pull/32647/commits/83bfe1485c37d407de7eed11b8ad769a05f78b66

    Built with recent master clang (clang version 21.0.0git (git@github.com:llvm/llvm-project.git 88c1403981dee9844042a99dc357d8034cf5d197)

     0$ CC=clang CXX=clang++ cmake -B build --toolchain depends/x86_64-pc-linux-gnu/toolchain.cmake
     1Configure summary
     2=================
     3Executables:
     4  bitcoin ............................. ON
     5  bitcoind ............................ ON
     6  bitcoin-node (multiprocess) ......... OFF
     7  bitcoin-qt (GUI) .................... ON
     8  bitcoin-gui (GUI, multiprocess) ..... OFF
     9  bitcoin-cli ......................... ON
    10  bitcoin-tx .......................... ON
    11  bitcoin-util ........................ ON
    12  bitcoin-wallet ...................... ON
    13  bitcoin-chainstate (experimental) ... OFF
    14  libbitcoinkernel (experimental) ..... OFF
    15Optional features:
    16  wallet support ...................... ON
    17  external signer ..................... ON
    18  ZeroMQ .............................. ON
    19  IPC ................................. OFF
    20  USDT tracing ........................ ON
    21  QR code (GUI) ....................... ON
    22  DBus (GUI) .......................... ON
    23Tests:
    24  test_bitcoin ........................ ON
    25  test_bitcoin-qt ..................... ON
    26  bench_bitcoin ....................... OFF
    27  fuzz binary ......................... OFF
    28
    29Cross compiling ....................... FALSE
    30C++ compiler .......................... Clang 21.0.0, /usr/local/bin/clang++
    31CMAKE_BUILD_TYPE ...................... RelWithDebInfo
    32Preprocessor defined macros ...........
    33C++ compiler flags .................... -pipe -std=c++20 -O2 -O2 -g -std=c++20 -fPIC -fdebug-prefix-map=/bitcoin/src=. -fmacro-prefix-map=/bitcoin/src=. -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -Wstack-protector -fstack-protector-all -fcf-protection=full -fstack-clash-protection -Wall -Wextra -Wgnu -Wformat -Wformat-security -Wvla -Wshadow-field -Wthread-safety -Wthread-safety-pointer -Wloop-analysis -Wredundant-decls -Wunused-member-function -Wdate-time -Wconditional-uninitialized -Woverloaded-virtual -Wsuggest-override -Wimplicit-fallthrough -Wunreachable-code -Wdocumentation -Wself-assign -Wundef -Wno-unused-parameter
    34Linker flags .......................... -pipe -std=c++20 -O2 -O2 -g -fstack-protector-all -fcf-protection=full -fstack-clash-protection -Wl,-z,relro -Wl,-z,now -Wl,-z,separate-code -fPIE -pie
    35
    36NOTE: The summary above may not exactly match the final applied build flags
    37      if any additional CMAKE_* or environment variables have been modified.
    38      To see the exact flags applied, build with the --verbose option.
    39
    40Treat compiler warnings as errors ..... OFF
    41Use ccache for compiling .............. ON
    
  11. fanquake added the label DrahtBot Guix build requested on Jun 3, 2025
  12. DrahtBot commented at 4:18 pm on June 3, 2025: contributor

    Guix builds (on x86_64) [untrusted test-only build, possibly unsafe, not for production use]

    File commit e872a566f251c73908de8b6d243c94a6679c2eac(master) commit 9353e895f3ab41849cd032fc8db470e5a82e822e(pull/32647/merge)
    *-aarch64-linux-gnu-debug.tar.gz a739dc103d86f617... 198f4165e6d2e85a...
    *-aarch64-linux-gnu.tar.gz 0f0d31c42f4f2d2d... c54074e566fc792c...
    *-arm-linux-gnueabihf-debug.tar.gz afa0430c835e8f1c... fead90fba3c4a6be...
    *-arm-linux-gnueabihf.tar.gz 010feabf0915a095... c4a18bbd85d3e44f...
    *-arm64-apple-darwin-codesigning.tar.gz 7b875e03c57e2efc... fcc72264e6a09d9f...
    *-arm64-apple-darwin-unsigned.tar.gz 793191a7d4950039... debd734e7e9b3cd9...
    *-arm64-apple-darwin-unsigned.zip 1845f0fbeeece7e0... c7b9c86bd4a9da24...
    *-powerpc64-linux-gnu-debug.tar.gz aa7e0ee615db9f44... 2b8c4c1fae9cfcdc...
    *-powerpc64-linux-gnu.tar.gz a1e53bc390165dd8... 18d2b37df6cc2e8c...
    *-riscv64-linux-gnu-debug.tar.gz 7dae3bb6031a77df... f45b9dcca064566d...
    *-riscv64-linux-gnu.tar.gz 2cb1841a8c99a869... cab3d904d53b66bd...
    *-x86_64-apple-darwin-codesigning.tar.gz c9069898c9dfa819... 8f1a14210a9ff92f...
    *-x86_64-apple-darwin-unsigned.tar.gz f53fca0c4cf9dd34... 45014e52ca8bc531...
    *-x86_64-apple-darwin-unsigned.zip 1b12987823fac9e0... e1792ab8e8001264...
    *-x86_64-linux-gnu-debug.tar.gz a3e9366e073358a2... c446053d84b810f9...
    *-x86_64-linux-gnu.tar.gz 205d540fb95038c0... c2f9e7ec24192662...
    *.tar.gz 3726f568d907d4ba... e66ff30f54127cc1...
    SHA256SUMS.part 76d92bcb737be8bc... b600d6921e987538...
    guix_build.log 3e5640771f225b88... 141c274ed5648e9f...
    guix_build.log.diff ccb91d39f47cdd34...
  13. DrahtBot removed the label DrahtBot Guix build requested on Jun 3, 2025
  14. theuni approved
  15. theuni commented at 8:37 pm on June 3, 2025: member
    utACK 83bfe1485c37d407de7eed11b8ad769a05f78b66
  16. maflcko commented at 7:13 am on June 4, 2025: member
    lgtm ACK 83bfe1485c37d407de7eed11b8ad769a05f78b66
  17. fanquake merged this on Jun 4, 2025
  18. fanquake closed this on Jun 4, 2025

  19. fanquake deleted the branch on Jun 4, 2025

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2025-06-15 06:13 UTC

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