Skip to content

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

Merged
fanquake merged 2 commits into
bitcoin:masterfrom
fanquake:tsan_LIBCPP_REMOVE_TRANSITIVE_INCLUDES
Jul 25, 2024
Merged

fanquake merged 2 commits into
bitcoin:masterfrom
fanquake:tsan_LIBCPP_REMOVE_TRANSITIVE_INCLUDES

Conversation

@fanquake

Copy link
Copy Markdown
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.

@DrahtBot

DrahtBot commented Jul 24, 2024 •

Copy link
Copy Markdown
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.

@maflcko maflcko left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK ea038bd228284eee2840f8f0ec2eb58fd0ad38d8

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

Comment thread ci/test/00_setup_env_native_tsan.sh Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 (#30436 (comment))

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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

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

So might followup with this.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is an up-upstream issue / PR for this. google/leveldb#1013 & google/leveldb#896.

Comment thread src/init.h Resolved
fanquake added 2 commits July 24, 2024 15:57
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.
@fanquake
fanquake force-pushed the tsan_LIBCPP_REMOVE_TRANSITIVE_INCLUDES branch from ea038bd to e3edacc Compare July 24, 2024 15:25
@maflcko

maflcko commented Jul 24, 2024

Copy link
Copy Markdown
Member

re-ACK e3edacc

@hebasto

hebasto commented Jul 25, 2024

Copy link
Copy Markdown
Member

Ported to the CMake-based build system in hebasto#281.

hebasto added a commit to hebasto/bitcoin that referenced this pull request Jul 25, 2024
c814a1c fixup! ci: Migrate CI scripts to CMake (fanquake)
3de63c7 refactor: fix missing includes (fanquake)

Pull request description:

  This PR ports bitcoin#30519.

Top commit has no ACKs.

Tree-SHA512: ac9198e5065a08ae23f3dfcf7dfbb9c6f9c4b2f2345992141c88c232aa37da929ebb4a9c9405bf47d1fbd517e9aae4feb6c9220e036c0a04b26c5096f2cb09ba
@bitcoin bitcoin locked and limited conversation to collaborators Jul 25, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants