Skip to content

changes to compile with latest seastar and C++20 - #45198

Merged
tchaikov merged 12 commits into
ceph:masterfrom
tchaikov:wip-cxx-20
Mar 2, 2022
Merged

tchaikov merged 12 commits into
ceph:masterfrom
tchaikov:wip-cxx-20

Conversation

@tchaikov

@tchaikov tchaikov commented Feb 28, 2022 •

Copy link
Copy Markdown
Contributor

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands
  • jenkins retest this please
  • jenkins test classic perf
  • jenkins test crimson perf
  • jenkins test signed
  • jenkins test make check
  • jenkins test make check arm64
  • jenkins test submodules
  • jenkins test dashboard
  • jenkins test dashboard cephadm
  • jenkins test api
  • jenkins test docs
  • jenkins render docs
  • jenkins test ceph-volume all
  • jenkins test ceph-volume tox

@tchaikov
tchaikov requested a review from a team as a code owner February 28, 2022 16:18
@tchaikov tchaikov changed the title c++20 and changes to compile with latest seastar changes to compile with latest seastar and C++20 Feb 28, 2022
@tchaikov

Copy link
Copy Markdown
Contributor Author

this is an attempt to move #45133 forward. but it seems there is more hurdles ahead. probably it's worthy to get the partial work merged before the whole tree compiles with -std=c++20.

@cbodley

cbodley commented Feb 28, 2022

Copy link
Copy Markdown
Contributor

@tchaikov sounds good! i'll carry your commits in #45133 in the meantime

@cbodley

cbodley commented Feb 28, 2022

Copy link
Copy Markdown
Contributor

src/crimson/os/seastore/lba_manager/btree/lba_btree.cc:624:7: error: no viable conversion from 'iter_t' to 'iter_t'

this looks like a similar issue to the bufferlist iterator one i fixed in c2d942f by replacing the implicit conversion with a converting constructor

tchaikov added 7 commits March 2, 2022 00:28
to address following FTBFS:

/usr/bin/ccache /usr/bin/clang++-13 -DBOOST_ALL_NO_LIB -DBOOST_ASIO_DISABLE_CONCEPTS -DBOOST_ASIO_DISABLE_THREAD_KEYWORD_EXTENSION -DBOOST_ASIO_USE_TS_EXECUTOR_AS_DEFAULT -DBOOST_PROGRAM_OPTIONS_DYN_LINK -DBOOST_T$
In file included from /var/ssd/ceph/src/crimson/os/seastore/seastore_types.cc:4:
In file included from /var/ssd/ceph/src/crimson/os/seastore/seastore_types.h:14:
In file included from /var/ssd/ceph/src/include/denc.h:47:
/var/ssd/ceph/src/include/buffer.h:98:37: error: no template named 'unique_ptr' in namespace 'std'; did you mean 'boost::movelib::unique_ptr'?
struct unique_leakable_ptr : public std::unique_ptr<T, ceph::nop_delete<T>> {
                                    ^~~~~~~~~~~~~~~
                                    boost::movelib::unique_ptr
/opt/ceph/include/boost/move/unique_ptr.hpp:354:7: note: 'boost::movelib::unique_ptr' declared here
class unique_ptr
      ^

Signed-off-by: Kefu Chai <[email protected]>
seastar::metrics::label was dropped in a recent change. quote from
the commit message which removed this type:

>     In practice, it's an over-kill and just add information in the reporting
>    layer.

see also da395f31989a1ee333e489ffb251fc1152f12f0a in seastar repo

Signed-off-by: Kefu Chai <[email protected]>
otherwise the aggregate initialization for this type would fail to
work on C++20, as the user-declared ctor is defined for this struct.

Signed-off-by: Kefu Chai <[email protected]>
std::iterator<> is deprecated in C++17, so let's just
define the required traits directly.

Signed-off-by: Kefu Chai <[email protected]>
std::iterator<> is deprecated in C++17, so let's just
define the required traits directly.

Signed-off-by: Kefu Chai <[email protected]>
to silence warning from clang13 with -std=c++20, like

ceph/src/crimson/osd/replicated_recovery_backend.cc:1098:21: warning: loop variable '[off, len]' creates a copy from type 'const std::pair<const unsigned long, unsigned long>' [-Wrange-loop-construct]
    for (const auto [off, len] : extents) {
                    ^
ceph/src/crimson/osd/replicated_recovery_backend.cc:1098:10: note: use reference type 'const std::pair<const unsigned long, unsigned long> &' to prevent copying
    for (const auto [off, len] : extents) {
         ^~~~~~~~~~~~~~~~~~~~~~~
                    &

Signed-off-by: Kefu Chai <[email protected]>
tchaikov added 3 commits March 2, 2022 00:58
after the restructure of seastar source tree, we have to include
metrics.hh for accessing the metrics types.

Signed-off-by: Kefu Chai <[email protected]>
to avoid the pain of fixing the FTBFS with C++20 like

/var/ssd/ceph/src/crimson/os/seastore/omap_manager/btree/omap_btree_node_impl.cc:141:19: error: use of overloaded operator '!=' is ambiguous (with operand types 'crimson::os::seastore::omap_manager::StringKVInnerN$
  assert(child_pt != iter_end());
         ~~~~~~~~ ^  ~~~~~~~~~~
/usr/include/assert.h:93:27: note: expanded from macro 'assert'
     (static_cast <bool> (expr)                                         \
                          ^~~~
/var/ssd/ceph/src/crimson/os/seastore/omap_manager/btree/string_kv_node_layout.h:380:10: note: candidate function
    bool operator==(const iter_t &rhs) const {
         ^
/var/ssd/ceph/src/crimson/os/seastore/omap_manager/btree/string_kv_node_layout.h:380:10: note: candidate function (with reversed parameter order)

also, to be explicit is advisable.

Signed-off-by: Kefu Chai <[email protected]>
std::iterator<> is deprecated in C++17, so let's just
define the required traits directly.

Signed-off-by: Kefu Chai <[email protected]>
…is happy

if compiled with C++20, C++ concept is enabled. to ensure the
constraints required by when_all_impl() is fulfilled, we need to
specialize is_tuple_of_futures<> for interruptible_future.

Signed-off-by: Kefu Chai <[email protected]>
@tchaikov

tchaikov commented Mar 2, 2022

Copy link
Copy Markdown
Contributor Author

jenkins test make check

@tchaikov
tchaikov merged commit 8b8a96d into ceph:master Mar 2, 2022
@tchaikov
tchaikov deleted the wip-cxx-20 branch March 2, 2022 02:20
@tchaikov tchaikov mentioned this pull request Mar 2, 2022
1 task done
bazaah added a commit to bazaah/ceph that referenced this pull request Feb 25, 2025
This trait has been deprecated in C++17, with users instructed to
migrate to defining each associated type when implementing an iterator.

This quiets the _GLIBCXX17_DEPRECATED warnings when compiling the
project on a sufficiently new gcc.

This follows on from previous efforts in 8b8a96d (ceph#45198).

References: ceph#45198
References: https://www.fluentcpp.com/2018/05/08/std-iterator-deprecated/
Signed-off-by: Paul Stemmet <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants