ci: add _LIBCPP_REMOVE_TRANSITIVE_INCLUDES to TSAN (libc++) job #30519

pull fanquake wants to merge 2 commits into bitcoin:master from fanquake:tsan_LIBCPP_REMOVE_TRANSITIVE_INCLUDES changing 3 files +5 −6
  1. fanquake commented at 11:36 am on July 24, 2024: member

    Add _LIBCPP_REMOVE_TRANSITIVE_INCLUDES to one of the libc++ CI jobs, to catch missing includes, that are otherwise hidden by transitive includes inside libc++. A more appropriate place for this might be the tidy job, but that does not use libc++.

    See https://libcxx.llvm.org/DesignDocs/HeaderRemovalPolicy.html for more information.

  2. DrahtBot commented at 11:36 am on July 24, 2024: contributor

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

    Code Coverage

    For detailed information about the code coverage, see the test coverage report.

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK maflcko

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

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #30454 (build: Introduce CMake-based build system by hebasto)
    • #29790 ([DO NOT MERGE] cmake: Migrate CI scripts to CMake-based build system – WIP by hebasto)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

  3. DrahtBot added the label Tests on Jul 24, 2024
  4. maflcko added the label Needs CMake port on Jul 24, 2024
  5. in ci/test/00_setup_env_native_tsan.sh:14 in ea038bd228 outdated
    10@@ -11,4 +11,4 @@ export CI_IMAGE_NAME_TAG="docker.io/ubuntu:24.04"
    11 export PACKAGES="clang-18 llvm-18 libclang-rt-18-dev libc++abi-18-dev libc++-18-dev python3-zmq"
    12 export DEP_OPTS="CC=clang-18 CXX='clang++-18 -stdlib=libc++'"
    13 export GOAL="install"
    14-export BITCOIN_CONFIG="--enable-zmq CPPFLAGS='-DARENA_DEBUG -DDEBUG_LOCKORDER -DDEBUG_LOCKCONTENTION' --with-sanitizers=thread"
    15+export BITCOIN_CONFIG="--enable-zmq CPPFLAGS='-DARENA_DEBUG -DDEBUG_LOCKORDER -DDEBUG_LOCKCONTENTION -D_LIBCPP_REMOVE_TRANSITIVE_INCLUDES' --with-sanitizers=thread"
    


    maflcko commented at 11:51 am on July 24, 2024:

    nit: The same can be achieved, by setting C++23, according to the docs.

    This may be beneficial for other reasons as well, even if it is just turning existing compile warnings into errors (https://github.com/bitcoin/bitcoin/pull/30436#discussion_r1675775175)

    So adding -std=c++23 here, and a comment that libc++ is required for the feature seems better. But this is fine either way.


    fanquake commented at 3:19 pm on July 24, 2024:

    Thanks, had a look at this, and ran into issues with at least leveldb, which we’d first have to fix in the subtree, i.e:

     0In file included from leveldb/util/comparator.cc:14:
     1./leveldb/util/no_destructor.h:40:17: error: 'aligned_storage<8, 8>' is deprecated [-Werror,-Wdeprecated-declarations]
     2   40 |   typename std::aligned_storage<sizeof(InstanceType),
     3      |                 ^
     4leveldb/util/comparator.cc:71:47: note: in instantiation of template class 'leveldb::NoDestructor<leveldb::(anonymous namespace)::BytewiseComparatorImpl>' requested here
     5   71 |   static NoDestructor<BytewiseComparatorImpl> singleton;
     6      |                                               ^
     7/usr/lib/llvm-18/bin/../include/c++/v1/__type_traits/aligned_storage.h:90:8: note: 'aligned_storage<8, 8>' has been explicitly marked deprecated here
     8   90 | struct _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_TEMPLATE_VIS aligned_storage {
     9      |        ^
    10/usr/lib/llvm-18/bin/../include/c++/v1/__config:1013:41: note: expanded from macro '_LIBCPP_DEPRECATED_IN_CXX23'
    11 1013 | #    define _LIBCPP_DEPRECATED_IN_CXX23 _LIBCPP_DEPRECATED
    12      |                                         ^
    13/usr/lib/llvm-18/bin/../include/c++/v1/__config:974:49: note: expanded from macro '_LIBCPP_DEPRECATED'
    14  974 | #      define _LIBCPP_DEPRECATED __attribute__((__deprecated__))
    15      |                                                 ^
    161 error generated.
    

    So might followup with this.


    fanquake commented at 3:28 pm on July 24, 2024:
  6. in src/init.h:12 in ea038bd228 outdated
     6@@ -7,6 +7,7 @@
     7 #define BITCOIN_INIT_H
     8 
     9 #include <any>
    10+#include <atomic>
    11 #include <memory>
    12 #include <string>
    


    maflcko commented at 11:52 am on July 24, 2024:

    nit: If it compiles, while touching, could fix all headers?

    0init.h should add these lines:
    1#include <atomic>  // for atomic
    2
    3init.h should remove these lines:
    4- #include <any>  // lines 9-9
    5- #include <memory>  // lines 10-10
    6- #include <string>  // lines 11-11
    

    fanquake commented at 3:22 pm on July 24, 2024:
    Thanks, added.
  7. maflcko approved
  8. maflcko commented at 11:53 am on July 24, 2024: member

    ACK ea038bd228284eee2840f8f0ec2eb58fd0ad38d8

    This is useful to catch build failures before they hit users that compile from source.

  9. refactor: fix missing includes
    These cause compile failures with _LIBCPP_REMOVE_TRANSITIVE_INCLUDES.
    i.e:
    ```bash
    In file included from init.cpp:8:
    ./init.h:46:54: error: no template named 'atomic' in namespace 'std'
       46 | bool AppInitBasicSetup(const ArgsManager& args, std::atomic<int>& exit_status);
          |                                                 ~~~~~^
    1 error generated.
    ```
    
    See: https://libcxx.llvm.org/DesignDocs/HeaderRemovalPolicy.html.
    6e786165ca
  10. ci: add _LIBCPP_REMOVE_TRANSITIVE_INCLUDES to TSAN job
    See: https://libcxx.llvm.org/DesignDocs/HeaderRemovalPolicy.html.
    e3edaccd9d
  11. fanquake force-pushed on Jul 24, 2024
  12. maflcko commented at 3:43 pm on July 24, 2024: member
    re-ACK e3edaccd9deb2da50be70d2d8768eca8821785c7
  13. fanquake merged this on Jul 25, 2024
  14. fanquake closed this on Jul 25, 2024

  15. fanquake deleted the branch on Jul 25, 2024
  16. hebasto commented at 10:13 am on July 25, 2024: member
    Ported to the CMake-based build system in https://github.com/hebasto/bitcoin/pull/281.
  17. hebasto removed the label Needs CMake port on Jul 25, 2024
  18. hebasto referenced this in commit 52829c3e1e on Jul 25, 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: 2024-09-08 01:12 UTC

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