]> git.apps.os.sepia.ceph.com Git - ceph.git/commit
common/ceph_context: Fix std::atomic<std::shared_ptr> compatibility 62493/head
authorKefu Chai <tchaikov@gmail.com>
Tue, 25 Mar 2025 13:40:00 +0000 (21:40 +0800)
committerKefu Chai <tchaikov@gmail.com>
Thu, 27 Mar 2025 00:05:55 +0000 (08:05 +0800)
commitd51ed04ef611af4ffa4c2cedae707874410b623c
tree26aae1edb8a5f0d82c6a2e94fb61a1a9d559320d
parentec1feb7faffe4666e945d7730a03a7ba0f153a62
common/ceph_context: Fix std::atomic<std::shared_ptr> compatibility

Previously, we relied on the __GNUC__ macro to check for std::atomic<std::shared_ptr>
support, which was inaccurate. This approach failed with Clang builds using libstdc++,
even when the feature was implemented. The warning looks like:

```
/usr/lib/gcc/x86_64-redhat-linux/15/../../../../include/c++/15/bits/shared_ptr_atomic.h:131:5: note: 'atomic_load_explicit<std::vector<entity_addrvec_t>>' has been explicitly marked deprecated here
  131 |     _GLIBCXX20_DEPRECATED_SUGGEST("std::atomic<std::shared_ptr<T>>")
      |     ^
```

This change uses a standard-compliant feature test macro (__cpp_lib_atomic_shared_ptr)
to correctly detect support for std::atomic<std::shared_ptr>. This resolves compilation
issues and improves portability across different compilers and standard library
implementations.

Refs 5b0d849730ce20d68ffafcb612c5f6fc8b87dd9a

Signed-off-by: Kefu Chai <tchaikov@gmail.com>
src/common/ceph_context.h