build: use _LIBCPP_ENABLE_DEBUG_MODE over ENABLE_ASSERTIONS #28479

pull fanquake wants to merge 1 commits into bitcoin:master from fanquake:libcxx_debug_mode changing 1 files +1 −1
  1. fanquake commented at 1:20 PM on September 14, 2023: member

    _LIBCPP_ENABLE_ASSERTIONS is deprecated, and will be removed. See (from libc++ __config in main):

    TODO(hardening): remove this in LLVM 19. This is for backward compatibility -- make enabling _LIBCPP_ENABLE_ASSERTIONS (which predates hardening modes) equivalent to setting the safe mode. ifdef _LIBCPP_ENABLE_ASSERTIONS warning "_LIBCPP_ENABLE_ASSERTIONS is deprecated, please use _LIBCPP_ENABLE_SAFE_MODE instead."

    From LLVM 17, _LIBCPP_ENABLE_DEBUG_MODE can be used instead, which also performs more checks than safe mode:

    Enables the debug mode which contains all the checks from the hardened mode and additionally more expensive checks that may affect the complexity of algorithms. The debug mode is intended to be used for testing, not in production. Mutually exclusive with _LIBCPP_ENABLE_HARDENED_MODE and _LIBCPP_ENABLE_SAFE_MODE.

    See https://libcxx.llvm.org/Hardening.html.

    Related to #28476.

  2. build: use _LIBCPP_ENABLE_DEBUG_MODE over ENABLE_ASSERTIONS
    `_LIBCPP_ENABLE_ASSERTIONS` is deprecated, and will be removed. [See (from libc++ __config in main)](https://github.com/llvm/llvm-project/blob/b57df9fe9a1a230f277d671bfa0884bbda9fc1c5/libcxx/include/__config#L205-L209):
    
    > TODO(hardening): remove this in LLVM 19.
    > This is for backward compatibility -- make enabling `_LIBCPP_ENABLE_ASSERTIONS` (which predates hardening modes)
    > equivalent to setting the safe mode.
    > ifdef _LIBCPP_ENABLE_ASSERTIONS
    > warning "_LIBCPP_ENABLE_ASSERTIONS is deprecated, please use _LIBCPP_ENABLE_SAFE_MODE instead."
    
    From LLVM 17, `_LIBCPP_ENABLE_DEBUG_MODE` can be used instead.
    
    See https://libcxx.llvm.org/Hardening.html.
    
    Related to #28476.
    4a825039a5
  3. DrahtBot commented at 1:20 PM on September 14, 2023: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

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

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK MarcoFalke

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

  4. DrahtBot added the label Build system on Sep 14, 2023
  5. maflcko commented at 2:12 PM on September 14, 2023: member

    Concept ACK. This should fix the warning:

    make
    Making all in src
    make[1]: Entering directory '/bitcoin-core/src'
    make[2]: Entering directory '/bitcoin-core/src'
    make[3]: Entering directory '/bitcoin-core'
    make[3]: Leaving directory '/bitcoin-core'
      CXX      init/bitcoind-bitcoind.o
    In file included from init/bitcoind.cpp:5:
    In file included from ./common/args.h:8:
    In file included from ./common/settings.h:8:
    In file included from ./util/fs.h:8:
    In file included from ./tinyformat.h:144:
    In file included from /usr/lib/llvm-17/bin/../include/c++/v1/algorithm:1739:
    In file included from /usr/lib/llvm-17/bin/../include/c++/v1/__assert:13:
    /usr/lib/llvm-17/bin/../include/c++/v1/__config:215:6: warning: "_LIBCPP_ENABLE_ASSERTIONS is deprecated, please use _LIBCPP_ENABLE_HARDENED_MODE instead." [-W#warnings]
      215 | #    warning "_LIBCPP_ENABLE_ASSERTIONS is deprecated, please use _LIBCPP_ENABLE_HARDENED_MODE instead."
          |      ^
    1 warning generated.
    

    To reproduce on a fresh install of mantic:

    export DEBIAN_FRONTEND=noninteractive && apt update && apt install curl wget htop git vim ccache -y && git clone https://github.com/bitcoin/bitcoin.git  --depth=1 ./bitcoin-core && cd bitcoin-core && apt install libc++abi-17-dev libc++-17-dev clang-17 llvm-17 build-essential libtool autotools-dev automake pkg-config bsdmainutils python3-zmq      make automake cmake curl  libtool binutils bsdmainutils pkg-config python3 patch bison        -y  && ( cd depends && make CC=clang-17 CXX="clang++-17 -stdlib=libc++" DEBUG=1 NO_QT=1 NO_WALLET=1 NO_ZMQ=1 NO_UPNP=1 NO_NATPMP=1 -j $(nproc) ) &&  ./autogen.sh && CONFIG_SITE="$PWD/depends/x86_64-pc-linux-gnu/share/config.site" ./configure  && make -j $(nproc)
    
  6. maflcko commented at 2:14 PM on September 14, 2023: member

    As a combined follow-up idea, #27495 could be re-opened and re-based?

  7. maflcko approved
  8. maflcko commented at 2:18 PM on September 14, 2023: member

    lgtm ACK 4a825039a509c43ba20b2cd7aab448b3be16bcc3 🙏

    <details><summary>Show signature</summary>

    Signature:

    untrusted comment: signature from minisign secret key on empty file; verify via: minisign -Vm "${path_to_any_empty_file}" -P RWTRmVTMeKV5noAMqVlsMugDDCyyTSbA3Re5AkUrhvLVln0tSaFWglOw -x "${path_to_this_whole_four_line_signature_blob}"
    RUTRmVTMeKV5npGrKx1nqXCw5zeVHdtdYURB/KlyA/LMFgpNCs+SkW9a8N95d+U4AP1RJMi+krxU1A3Yux4bpwZNLvVBKy0wLgM=
    trusted comment: lgtm ACK 4a825039a509c43ba20b2cd7aab448b3be16bcc3 🙏
    qd5zY5wVVk1rUQRh+ogkg4hRqTNWyaizwMXgS0oZqgG21kesDV/Wyd4gOwysaH5/ossdSsnSQmb+Sy3hZmTNCw==
    

    </details>

  9. fanquake commented at 2:41 PM on September 14, 2023: member

    As a combined follow-up idea, #27495 could be re-opened and re-based?

    Sure. Reopened and rebased (on master and this and 28476).

  10. fanquake merged this on Sep 16, 2023
  11. fanquake closed this on Sep 16, 2023

  12. fanquake deleted the branch on Sep 16, 2023
  13. Frank-GER referenced this in commit 17a3555c06 on Sep 19, 2023
  14. bitcoin locked this on Sep 15, 2024

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: 2026-04-15 15:13 UTC

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