]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commit
common/ceph_context: use std::atomic<std::shared_ptr<T>>
authorMax Kellermann <max.kellermann@ionos.com>
Wed, 9 Oct 2024 21:21:11 +0000 (23:21 +0200)
committerMax Kellermann <max.kellermann@ionos.com>
Fri, 11 Oct 2024 10:26:37 +0000 (12:26 +0200)
commit5b0d849730ce20d68ffafcb612c5f6fc8b87dd9a
treef71e8c7e0fdd3aba0989d1ca99fd03b68a637ecd
parentb2a4bd8409dcfaaa2e84ed450a0d31126ac9b4c3
common/ceph_context: use std::atomic<std::shared_ptr<T>>

Fixes the compiler warning:

 src/common/ceph_context.h: In member function ‘std::shared_ptr<std::vector<entity_addrvec_t> > ceph::common::CephContext::get_mon_addrs() const’:
 src/common/ceph_context.h:288:36: warning: ‘std::shared_ptr<_Tp> std::atomic_load_explicit(const shared_ptr<_Tp>*, memory_order) [with _Tp = vector<entity_addrvec_t>]’ is deprecated: use 'std::atomic<std::shared_ptr<T>>' instead [-Wdeprecated-declarations]
   288 |     auto ptr = atomic_load_explicit(&_mon_addrs, std::memory_order_relaxed);
       |                ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 /usr/include/c++/14/bits/shared_ptr_atomic.h:133:5: note: declared here
   133 |     atomic_load_explicit(const shared_ptr<_Tp>* __p, memory_order)
       |     ^~~~~~~~~~~~~~~~~~~~

The modernized version does not build with GCC 11, so this patch
contains both versions for now, switched by a `__GNUC__` preprocessor
check.

Signed-off-by: Max Kellermann <max.kellermann@ionos.com>
src/common/ceph_context.h